akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <string>

typedef long long ll;
using namespace std;
const int mod = 1000000007;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

map<ll,ll> prime_factor(ll n) {
    map<ll, ll> res;
    for (ll i = 2; i * i <= n; i++) {
        //if (n % i == 0) {
            while (n % i == 0) {
                res[i]++;
                n /= i;
            }
        //}
    }
    if (n != 1)
        res[n] = 1;
    return res;
}

int main() {
    ll A, B;
    cin >> A >> B;

    ll C = gcd(A, B);

    map<ll, ll> mp = prime_factor(C);

    cout << mp.size() + 1 << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int L, R, d;
  cin >> L >> R >> d;
  cout << R / d - (L - 1) / d << endl;
}

Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		if(N < K) {
			System.out.println(1);
		} else if(N%K==0) {
			System.out.println(0);
		}else{
			System.out.println(1);
		}
	}
}


Measured memory_bytes: 23636
#include <stdio.h>
#include <string.h>

int main() {
    char s[1001];
    int i, sum, len;

    while(1) {
        sum = 0;
        scanf("%s", s);
        if (s[0] == '0') break;

        len = strlen(s);

        for (i = 0; i < len; i++) {
            sum += s[i] - '0';
        }
        printf("%d\n", sum);
    }

    return 0;
}



Measured memory_bytes: 2124
#include <bits/stdc++.h>
 
#define lli long long int
#define pb push_back
#define pii pair <int, int>
#define pll pair <lli, lli>
#define _F first
#define _S second
#define mset(x) memset(x, 0, sizeof(x))
#define fastio() ios_base::sync_with_stdio(0)
 
using namespace std;
 
int main()
{
	lli n, m;
	cin >> n >> m;
 
	vector < pair <pll, lli> > E;
 
	while(m--)
	{
		lli x, y, w;
		cin >> x >> y >> w;
 
		E.pb({{x, y}, w});
	}
 
	lli inf = - (1e17);
 
	lli D[n+1];
	for(int i=0; i<=n; i++)
		D[i] = inf;
 
	D[1] = 0;
 
	for(int i=0; i<n-1; i++)
	{
		for(int j=0; j<E.size(); j++)
		{
			lli x, y, w;
 
			tie(x, y) = E[j].first;
			w = E[j].second;
 
			D[y] = max(D[y], D[x] + w);
 		}
	}
 
	lli ans = D[n];
 
	for(int i=0; i<n-1; i++)
	{
		for(int j=0; j<E.size(); j++)
		{
			lli x, y, w;
 
			tie(x, y) = E[j].first;
			w = E[j].second;
 
			D[y] = max(D[y], D[x] + w);
 		}
	}
 
	if(D[n] > ans)
		cout << "inf" << endl;
	else
		cout << ans << endl;
 
 
	return (0-0);	
}

Measured memory_bytes: 384
#include <iostream>

int main() {
  int n;
  std::cin >> n;

  bool ok = false;
  for (int i = 1; i <= 9; ++i) {
    if (n % i == 0 && n / i <= 9) {
      ok = true;
      break;
    }
  }
  std::cout << (ok ? "Yes" : "No") << std::endl;
}

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

constexpr int N = 40 + 1;
constexpr int M = (N - 1) * 10 + 1;
constexpr int INF = 1000000;
int table[N][M][M];

int main()
{
    for (int i = 0; i < N; ++i)
    {
        for (int j = 0; j < M; ++j)
        {
            for (int k = 0; k < M; ++k)
            {
                table[i][j][k] = INF;
            }
        }
    }

    int n, ma, mb;
    std::cin >> n >> ma >> mb;
    std::vector<int> a(n), b(n), c(n);
    for (int i = 0; i < n; ++i)
    {
        int x, y, z;
        std::cin >> x >> y >> z;
        a[i] = x;
        b[i] = y;
        c[i] = z;
    }

    table[0][0][0] = 0;
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < M; ++j)
        {
            for (int k = 0; k < M; ++k)
            {
                table[i + 1][j][k] = std::min(table[i + 1][j][k], table[i][j][k]);
                if (j + a[i] < M && k + b[i] < M)
                {
                    table[i + 1][j + a[i]][k + b[i]] = std::min(table[i + 1][j + a[i]][k + b[i]], table[i][j][k] + c[i]);
                }
            }
        }
    }

    int cost = INF;
    for (int j = 1; j < M; ++j)
    {
        for (int k = 1; k < M; ++k)
        {
            if (j * mb == k * ma)
            {
                cost = std::min(cost, table[n][j][k]);
            }
        }
    }
    if (cost >= INF)
    {
        cost = -1;
    }

    std::cout << cost << std::endl;
    return 0;
}


Measured memory_bytes: 29396
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

ll mpow(ll a, ll b){
    if(b==0) return 1;
    else if(b%2==0){
        ll memo = mpow(a, b/2);
        return memo*memo%mod;
    }else{
        return mpow(a, b-1)*a%mod;
    }

}

ll nCr(ll n, ll r){
    ll ret=1;
    rep(i,r){
        ret *= n-i;
        ret %= mod;
        ret *=mpow(r-i, mod-2);
        ret %= mod;
    }
    return ret;
}
int main(){
    fast_io


    ll n;
    cin>>n;
    int a,b;
    cin>>a>>b;
    ll ans;
    ans=((mpow(2, n)-1+mod)%mod-(nCr(n, a)+nCr(n, b))%mod+mod)%mod;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
N = input()
A = map(int, raw_input().split())
ans_def = 0
ans_def += abs(A[0])
for i in range(N - 1):
    ans_def += abs(A[i+1] - A[i])
ans_def += abs(A[N-1])

for i in range(N):
    if i == 0:
        tmp_1 = 0
        tmp_2 = A[i+1]
    elif i == N-1:
        tmp_1 = A[i-1]
        tmp_2 = 0
    else:
        tmp_1 = A[i-1]
        tmp_2 = A[i+1]

    if (tmp_2 - A[i]) * (A[i] - tmp_1) >= 0:
        print(ans_def)
    elif (A[i] - tmp_2) * (tmp_2 - tmp_1) >= 0:
        print(ans_def - abs(tmp_2 - A[i]) * 2)
    else:
        print(ans_def - abs(tmp_1 - A[i]) * 2)

Measured memory_bytes: 11148
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const int INF=1e9;
const ll MX = 1e18;
const ll MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
const string tr="abcdefghijklmnopqrstuvwxyz";
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define YN {puts("YES");}else{puts("NO");}
const ll MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {fac[0] = fac[1] = 1;finv[0] = finv[1] = 1;inv[1] = 1;for (ll i = 2; i < MAX; i++){fac[i] = fac[i - 1] * i % MOD;inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;finv[i] = finv[i - 1] * inv[i] % MOD;}}
long long COM(ll n, ll k){if (n < k) return 0;if (n < 0 || k < 0) return 0;return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;}
ll llpow(ll n,ll i){ll cnt=n;  for(ll j=0;j<i-1;j++){n*=cnt;}return n;}

int main(){
  int n;
  cin>>n;
  vi a(n);
  rep(i,n) cin>>a[i];
  bool ja=false;
  rep(i,n){
    if(a[i]>i+1) ja=true;
  }
  if(ja) dame;
  vi b(n);
  rep(i,n){
    b.emplace(b.begin()+a[i]-1,a[i]);
  }
  rep(i,n){
    cout<<b[i]<<endl;
  }
}

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

namespace ConsoleApp5
{
    class Program
    {

        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] L = new int[N];
            String S = Console.ReadLine();
            String[] line = S.Split(' ');

            for (int i = 0; i < N; i++)
            {
                L[i] = int.Parse(line[i]);
            }

            Array.Sort(L);

            /*
            int[,] wa = new int[N, N];

            
            for (int i = 0; i < N - 1; i++)
            {
                for (int j = i + 1; j < N; j++)
                {
                    wa[i, j] = L[i] + L[j];
                }
            }
            */

            int ans = 0;

            for (int k = N - 1; k >= 2; k--)
            {
                for (int i = 0; i < k; i++)
                {
                    for (int j = i + 1; j < k; j++)
                    {
                        if (L[i] + L[j] > L[k])
                        {
                            ans = ans + k - j;
                            break;
                        }

                    }
                }
            }

            Console.WriteLine(ans);

        }
    }
}

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

 string s;
int main() {
    cin >> s;
    if(s.length() % 2 == 1) return cout << "No" && 0;
    for(int i = 0; i < s.length(); i += 2) {
        if(s[i] != 'h' || s[i + 1] != 'i') return cout << "No" && 0;
    }
    cout << "Yes";
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(dead_code)]
use std::cmp::*;
use std::collections::*;

const INF: i64 = 0x3f3f3f3f;
const DX: [usize; 4] = [1, 0, std::usize::MAX, 0];
const DY: [usize; 4] = [0, 1, 0, std::usize::MAX];

fn main() {
    let (h, w, k): (usize, usize, i64) = readln();
    let mut m: Vec<Vec<char>> = Vec::with_capacity(h);
    let mut d: Vec<Vec<i64>> = vec![vec![INF;w];h];
    for _ in 0..h {
        let cs = get_chars();
        m.push(cs);
    }

    let mut start: (usize, usize) = (0, 0);
    for i in 0..h {
        for j in 0..w {
            if m[i][j] == 'S' {
                start = (i, j);
            }
        }
    }

    let mut q = VecDeque::new();
    q.push_back((start, 0));
    d[start.0][start.1] = 0;
    while let Some(((x, y), dist)) = q.pop_front() {
        for i in 0..4 {
            let nx = x.wrapping_add(DX[i]);
            let ny = y.wrapping_add(DY[i]);
            if nx < h && ny < w {
                if m[nx][ny] == '.' && d[nx][ny] == INF {
                    d[nx][ny] = dist + 1;
                    q.push_back(((nx, ny), dist + 1));
                }
            }
        }
    }

    let mut res = INF;
    for i in 0..h {
        for j in 0..w {
            if d[i][j] <= k {
                let &t = vec![i, j, h - i - 1, w - j - 1].iter().min().unwrap();
                res = min(res, (t as i64 + k - 1) / k);
            }
        }
    }

    println!("{}", res + 1);
}


fn get_line() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_string()
}

fn get_chars() -> Vec<char> {
    get_line().chars().collect()
}

fn readln<T: Read>() -> T {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    T::read(buf.trim_right())
}

trait Read {
    fn read(s: &str) -> Self;
}

macro_rules! read_impl{
    ($($t:ty)*) => ($(
        impl Read for $t {
            fn read(s: &str) -> $t{
                s.parse().unwrap()
            }
        }
    )*)
}
read_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }

impl<T: Read> Read for Vec<T> {
    fn read(s: &str) -> Self {
        s.split_whitespace().map(T::read).collect()
    }
}

impl<A: Read, B: Read> Read for (A, B) {
    fn read(s: &str) -> Self {
        let tokens: Vec<_> = s.split_whitespace().collect();
        (A::read(tokens[0]), B::read(tokens[1]))
    }
}

impl<A: Read, B: Read, C: Read> Read for (A, B, C) {
    fn read(s: &str) -> Self {
        let tokens: Vec<_> = s.split_whitespace().collect();
        (A::read(tokens[0]), B::read(tokens[1]), C::read(tokens[2]))
    }
}

Measured memory_bytes: 12540
'use strict'

function main(s) {

  const set = new Set(['maerd', 'remaerd', 'esare', 'resare']);
  let str = s.split('\n')[0].split('').reverse().join('');

  const sliceHead = (head) => {
    if (head.length < 5) return false;

    for (let i = 5; i <= 7; i++) {
      let sliced = head.slice(0, i);
      if (set.has(sliced)) {
        str = head.slice(i);
        return true;
      }
    }
    
    return false;
  }

  while (sliceHead(str));

  const ans = (str.length === 0) ? 'YES' : 'NO';
  console.log(ans);
}

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


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

using namespace std;

typedef long long ll;

const int INF = 1000000000;

int main()
{
  int N, Y; scanf("%d %d", &N, &Y);
  bool ok = false;
  Y /= 1000;
  for (int i = 0; !ok and i <= N; ++i) {
    for (int j = 0; !ok and i + j <= N; ++j) {
      int k = N - i - j;
      if (10 * i + 5 * j + k == Y) {
        printf("%d %d %d\n", i, j, k);
        return 0;
      }
    }
  }
  printf("-1 -1 -1\n");
  return 0;
}


Measured memory_bytes: 256
//author : 'Amit Singh Sansoya @amit3200'
//it was all meant to happen as i was all talk!
#include<bits/stdc++.h>
using namespace std;
vector<int> dp,arr;
int n,k;
int main(){
	cin>>n>>k;
	for(int i=0;i<n;i++){
		int data;
		cin>>data;
		arr.push_back(data);
	}
	dp.resize(n+1,INT_MAX);
	dp[0]=0;
	for(int i=0;i<n;i++){
		for(int j=1;j<=k;j++){
			if(i+j<n)
				dp[i+j]=min(dp[i+j],dp[i]+abs(arr[j+i]-arr[i]));
		}
	}
	cout<<dp[n-1]<<"\n";
}

Measured memory_bytes: 1144
#include <bits/stdc++.h>
using namespace std;
#define TRACE(x) x
#define WATCH(x) TRACE( cout << #x" = " << x << endl)
#define PRINT(x) TRACE(printf(x))
#define WATCHR(a, b) TRACE( for(auto c = a; c != b;) cout << *(c++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end()); } )
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define mp make_pair
#define st first
#define nd second

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using ld = long double;
using pll = pair<ll, ll>;
using vll = vector<ll>;
using pll = pair<ll, ll>;

void buff() { ios::sync_with_stdio( false ); cin.tie( nullptr ); }

constexpr ll MOD = 1e9 + 7;

inline ll pow_mod( ll a, ll b, ll mod = MOD) {
    ll res = 1; a %= mod; assert(b >= 0);
    for(;b;b>>=1) {
        if(b&1) res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}
// End of template code!
int main() 
{
    buff();
    int n;
    cin >> n;
    vector<long long> V(n);
    for(auto& x : V) cin >> x;
    
    long long sum = V[0] + V[1];
    long long xr = 0;
    for(const auto& x : V) xr ^= x;
    
    xr ^= (V[0] ^ V[1]);

    long long start = (sum - xr) / 2;
    long long x = start, y = start;
    
    for(long long b = 60; b >= 0; --b)
    {
        if(xr & (1ll << b)) {
            if(x + (1ll << b) <= V[0]) {
                x |= (1ll << b);
            }
            else y |= (1ll << b);
        }
    }
    if(x + y == sum && (x ^ y) == xr && x != 0 && x <= V[0]) cout << y - V[1] << '\n';
    else cout << -1 << '\n';
    return 0;
}



Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>

using namespace std;

typedef long long int ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, int> pli;
typedef std::pair<ll, ll> pll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
	int H, W;
	while (true)
	{
		cin >> H >> W;
		if (H == 0 && W == 0)break;
		REP(h, H)
		{
			REP(w, W)
			{
				cout << '#';
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}


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

int main() {
	int q; cin >> q;
	rep(i, q) {
		int c, a, n; cin >> c >> a >> n;
		int cnt = 0;
		while (1) {
			if (c&&a&&n) {
				c--; a--; n--;
			}
			else if (c > 1 && a) {
				c -= 2; a--;
			}
			else if (c > 2) {
				c -= 3;
			}
			else break;
			cnt++;
		}
		cout << cnt << endl;
	}
}

Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const ll mod=998244353,MAX=200001,INF=1<<30;

int main(){
    
    while(1){
        int N;cin>>N;
        if(N==0) break;
    N=1000-N;
    int ans=0;
    if(N>=500){
        ans++;
        N-=500;
    }
    if(N>=100){
        ans+=N/100;
        N=N%100;
    }
    if(N>=50){
        ans++;
        N-=50;
    }
    if(N>=10){
        ans+=N/10;
        N=N%10;
    }
    if(N>=5){
        ans+=N/5;
        N=N%5;
    }
    ans+=N;
    
    cout<<ans<<endl;
    }
    
}



Measured memory_bytes: 3088
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.lang.StringBuilder
import java.util.*

fun main(args: Array<String>) {
    val sc = FastScanner(System.`in`)
    val n = sc.nextInt()
    val set = mutableSetOf<String>()
    val i1 = 0
    val j2 = 0
    for (i2 in 0..j2 + 1) {
        val j3 = Math.max(i1, i2)
        for (i3 in 0..j3 + 1) {
            val j4 = Math.max(j3, i3)
            for (i4 in 0..j4 + 1) {
                val j5 = Math.max(j4, i4)
                for (i5 in 0..j5 + 1) {
                    val j6 = Math.max(j5, i5)
                    for (i6 in 0..j6 + 1) {
                        val j7 = Math.max(j6, i6)
                        for (i7 in 0..j7 + 1) {
                            val j8 = Math.max(j7, i7)
                            for (i8 in 0..j8 + 1) {
                                val j9 = Math.max(j8, i8)
                                for (i9 in 0..j9 + 1) {
                                    val j10 = Math.max(j9, i9)
                                    for (i10 in 0..j10 + 1) {
                                        val arr = arrayOf(i1, i2, i3, i4, i5, i6, i7, i8, i9, i10)
                                        val sb = StringBuilder()
                                        for (j in 0 until n) {
                                            sb.append('a' + arr[j])
                                        }
                                        set.add(sb.toString())
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    for (s in set.sorted()) {
        println(s)
    }
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


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

#define ll long long int 
ll mod=1e9+7;

vector<int> g[200005];
// int vis[200005];
// queue<int> q;
// int level[200005];

// void dfs(int i)
// {
//     vis[i] = 1;
//     for(int j=0;j<g[i].size();j++)
//     {
//         int child = g[i][j];
//         if(vis[child] == 0)
//         {
//             dfs(child);
//         }
//     }
// }

// void bfs(int i)
// {
//     vis[i] = 1;
//     while(!q.empty())
//     {
//         int top = q.front();
//         int len_adj = g[top].size();
//         int j;
//         for(j=0;j<len_adj;j++)
//         {
//             int v = g[top][j];
//             if(vis[v]==0)
//             {
//                 vis[v]=1;
//                 q.push(v);
//                 level[v] = level[top] + 1;
//             }
//         }   
//         q.pop();
//     }
// }

ll modular_exponentiation(ll base, ll power)
{
    ll ans = 1;
    base = base % mod;
    while (power > 0)
    {
        if (power & 1)
        {
            ans = (ans * base) % mod;
        }

        power /= 2;
        base = (base * base) % mod;
    }
    return ans;
}

int main()
{
    /* Faster input ouput */
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    // cout.tie(NULL);

    /* To read input from a file and output to a file */
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    
    int t = 1;
    // cin >> t;
    while(t--)
    {        
        ll n,i,j,m;
        cin >> n >> m;
        ll h[n+1];

        for(i=1;i<=n;i++)
        {
            cin >> h[i];
        }

        for(i=0;i<m;i++)
        {
            ll u,v;
            cin >> u >> v;
            g[u].push_back(v);
            g[v].push_back(u);
        }

        ll ans = 0;
        for(i=1;i<=n;i++)
        {
            int flag = 1;
            for(j=0;j<g[i].size();j++)
            {
                if(h[i] <= h[g[i][j]])
                {
                    flag = 0;
                }
            }

            if(flag == 1)
            {
                // cout << i << '\n';
                ans++;
            }
        }
        cout << ans << '\n';
    }

    
    
}

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

using System.Collections;

class Program
{
    static void Main()
    {
        int[] ab = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        int A = ab[0];
        int B = ab[1];

        Console.WriteLine(MathUtil.Max(A + B, A - B, A * B));
    }
}


static class MathUtil
{
    public static T Max<T>(params T[] datas)
    {
        return datas.Max();
    }

    public static T Min<T>(params T[] datas)
    {
        return datas.Min();
    }

    public static IEnumerable<IEnumerable<int>> GetPermutation(int n)
    {
        if (n == 0)
        {
            yield return Single(0);
            yield break;
        }

        for (int i = 0; i <= n; i++)
        {
            foreach (var x in GetPermutation(n - 1))
            {
                yield return Single(i).Concat(x.Select(itm => itm < i ? itm : itm + 1));
            }
        }
    }

    private static IEnumerable<int> Single(int x)
    {
        yield return x;
    }

    public static IEnumerable<int> EnumeratePrimeNumbers()
    {
        List<int> primes = new List<int>() { 2 };
        yield return 2;

        for (int i = 3; i < int.MaxValue; i++)
        {
            bool isPrime = true;
            int Sqrt = (int)Math.Sqrt(i) + 1;

            foreach (var prime in primes)
            {
                if (prime > Sqrt)
                {
                    break;
                }
                if (i % prime == 0)
                {
                    isPrime = false;
                    break;
                }
            }

            if (isPrime)
            {
                primes.Add(i);
                yield return i;
            }
        }
    }
}


Measured memory_bytes: 13396
fun main(args: Array<String>){
    val (N, M) = readLine()!!.split(" ").map { it.toInt() }
    val A = IntArray(M){ readLine()!!.toInt() }
    val mod = 1000000007L

    val dp = LongArray(N+1)
    dp[0] = 1
    if(!A.contains(1)){
        dp[1] = 1
    }
    A.forEach {
        dp[it] = -1L
    }
    for(i in 2..N){
        if(dp[i] != -1L){
            dp[i] = (if(dp[i - 1] != -1L) dp[i - 1] else 0) + (if(dp[i - 2] != -1L) dp[i - 2] else 0)
            dp[i] = dp[i] % mod
        }
    }
    println(dp[N])
}

Measured memory_bytes: 41276
#include <iostream>
using namespace std;
 
int main(int argc, const char * argv[]) {
 
    int N = 0;
    long long int result = 0;
    
    cin >> N;
    
    for (int i = 1; i <= N; i++) {
        if (i % 3 == 0) {
            continue;
        }else if(i % 5 == 0){
            continue;
        }else{
            result = result + i;
        }
    }
    cout << result;
    
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for (uint64_t i = 0; i <  (uint64_t)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)

int main() {
  uint64_t Ans = 0;  // 回答：
  int N; cin >> N;  // 文字列数１～４０００
  string S; cin >> S; // 対象文字列

  if ( N<3 ){cout << 0 << endl; return 0;}
  // ①Ｒ・Ｇ・Ｂから、一つずつ選ぶ組の数を出す。
  // ②ポイント i から ポイント j の向こうに距離の等しいポイント k を選定し、
  // 　ＲＧＢ３色なら、①の数から引く。
  uint64_t R=0;  // Rの数
  uint64_t G=0;  // Rの数
  uint64_t B=0;  // Rの数
  rep(i,N){
    if(S.at(i)=='R'){R++;}
    if(S.at(i)=='G'){G++;}
    if(S.at(i)=='B'){B++;}
  }
  Ans = R*G*B;

  int wk_int=0;
  rep(i,N){     // i の場所：０～Ｎ－３：こっちのパターンだと、はまらない場合がある。
    rep1(j,N){    // i から j までの距離：１～(N-i)/2 までで良いけど、端数処理が面倒
      wk_int = i+j+j;
      if( wk_int >= N ){break;}
      if( S.at(i)!=S.at(i+j) && S.at(i)!=S.at(i+j+j) && S.at(i+j)!=S.at(i+j+j) ) { Ans--; }
    }
  }
  // for(int d=1;d<N;d++){  // ２点間の距離：一定
  //   for(int i=0,j=d,k=2*d; k<N ; i++,j++,k++ ) {    // i の位置を１つずつずらす
  //     if(S[i]!=S[j]&&S[j]!=S[k]&&S[k]!=S[i]){ Ans--;}
  //   }
  // }
  cout << Ans << endl;
}


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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
ostream &operator<<(ostream &os, pair<ll, ll>&p){
  return os << p.first << " " << p.second;
}  
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll n,m;cin>>n>>m;
  ans1(n==m);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int ll
#define ll long long
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I32_MAX
#define MOD 1000000007
// #define MOD 998244353
#define MEM_SIZE 201010
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template <typename T>
void DEBUG(T e)
{
  if (DEBUG_OUT == false)
    return;
  std::cout << e << " ";
}
template <typename T>
void DEBUG(const std::vector<T> &v)
{
  if (DEBUG_OUT == false)
    return;
  for (const auto &e : v)
  {
    std::cout << e << " ";
  }
  std::cout << std::endl;
}
template <typename T>
void DEBUG(const std::vector<std::vector<T>> &vv)
{
  if (DEBUG_OUT == false)
    return;
  for (const auto &v : vv)
  {
    DEBUG(v);
  }
}
template <class T, class... Ts>
void DEBUG(T d, Ts... e)
{
  if (DEBUG_OUT == false)
    return;
  DEBUG(d);
  DEBUG(e...);
}
template <class T>
void corner(bool flg, T hoge)
{
  if (flg)
  {
    cout << hoge << endl;
    abort();
  }
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, T2 b)
{
  return a < b && (a = b, true);
}
template <typename T1, typename T2>
inline bool chmin(T1 &a, T2 b)
{
  return a > b && (a = b, true);
}

vector<int> divisor(int n)
{
  vector<int> ret;
  for (int i = 1; i * i <= n; i++)
  {
    if (n % i == 0)
    {
      ret.push_back(i);
      if (i * i != n)
        ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

template <typename T>
map<T, T> prime_factor(T n)
{
  map<T, T> ret;
  for (T i = 2; i * i <= n; i++)
  {
    T tmp = 0;
    while (n % i == 0)
    {
      tmp++;
      n /= i;
    }
    ret[i] = tmp;
  }
  if (n != 1)
    ret[n] = 1;
  return ret;
}
/*  divisor_num(n)
    入力：整数 n
    出力：nの約数の個数
    計算量：O(√n)
*/
template <typename T>
T divisor_num(T N)
{
  map<T, T> pf = prime_factor(N);
  T ret = 1;
  for (auto p : pf)
  {
    ret *= (p.second + 1);
  }
  return ret;
}

void solve(void)
{
  int n, x, m;
  cin >> n >> x >> m;
  int p = x;
  map<int, int> mp;
  int cnt = 0;
  int res = 0;
  for (int i = 0; i < n; i++)
  {
    if (mp[p] == 2)
      break;
    res += p;
    mp[p] += 1;
    p = p * p;
    p %= m;
    cnt += 1;
  }
  if (cnt == n)
  {
    cout << res << endl;
    return;
  }
  int r = n - cnt;
  int cycle_sum = 0;
  int cycle_num = 0;
  for (auto &&x : mp)
  {
    if (x.second == 2)
    {
      cycle_sum += x.first;
      cycle_num += 1;
    }
  }
  res += cycle_sum * (r / cycle_num);
  for (int i = 0; i < r % cycle_num; i++)
  {
    res += p;
    // mp[p] += 1;
    p = p * p;
    p %= m;
  }
  cout << res << endl;

  return;
}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


Measured memory_bytes: 6744
/**
 * C - Good Sequence
 */

#include <iostream>
#include <unordered_map>

using namespace std;

int main() {

    int N;
    unordered_map<int, int> A;

    cin >> N;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        if (A.find(a) == A.end()) {
            A[a] = 0;
        }
        A[a]++;
    }

    int count = 0;
    for (auto i : A) {
        if (i.first <= i.second) {
            count += (i.second - i.first < i.second) ? i.second - i.first : i.second;
        } else {
            count += i.second;
        }
    }

    cout << count << endl;
}

Measured memory_bytes: 4128
object Main extends App {
  scala.io.Source.stdin.getLines.toList.init
    .map(_.split(" ").map(_.toInt))
    .map(x => (x(0), x(1)))
    .map(x => List.fill(x._1)("#" * x._2).mkString("\n"))
    .map(x => println(x + "\n"))
}

Measured memory_bytes: 45492
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())
#define CLR(a) memset((a), 0, sizeof(a))
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

//using LL = long long;
using namespace std;

const int dy[] = {0, 0, 1, -1};
const int dx[] = {1, -1, 0, 0};
const double EPS = 1e-10;
const double PI = acos(-1.0);

void print_vector(vector<int> v){
    int n = v.size();
    for (int i = 0; i < n; i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
}

void seliction_Sort(vector<int> v, int n)
{
    int mini, count = 0;
    for (int i = 0; i < n - 1; i++)
    {
        mini = i;
        for (int j = i + 1; j < n; j++)
        {
            if (v[j] < v[mini])
                mini = j;
        }

        if (i != mini)
        {
            count++;
            swap(v[i], v[mini]);
        }
    }

    print_vector(v);

            // for (int i = 0; i < n; i++)
            // {
            //     if (i)
            //         cout << ' ';
            //     cout << v[i];
            // }
            cout
        << endl
        << count << endl;
}

int main()
{
    int n;
    cin >> n;
    vector<int> v;

    for (int temp; cin >> temp;)
    {
        v.push_back(temp);
    }

    seliction_Sort(v, n);

    return 0;
}


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

ll mod = 1e9 + 7;

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

  ll n;
  cin >> n;

  string s[n];
  ll res[5] = {};
  REP(i, n){
    cin >> s[i];
    if(s[i][0] == 'M') res[0]++;
    if(s[i][0] == 'A') res[1]++;
    if(s[i][0] == 'R') res[2]++;
    if(s[i][0] == 'C') res[3]++;
    if(s[i][0] == 'H') res[4]++;
  }

  ll a1[10] = {0, 0, 0, 0, 0, 0, 1, 1, 1, 2};
  ll a2[10] = {1, 1, 1, 2, 2, 3, 2, 2, 3, 3};
  ll a3[10] = {2, 3, 4, 3, 4, 4, 3, 4, 4, 4};

  ll cnt = 0;
  REP(i, 10) cnt += res[a1[i]] * res[a2[i]] * res[a3[i]];

  cout << cnt << endl;

  return 0;
}


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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<ll> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}


bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
//typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;
struct Train {
    int u, v;
    ll yen, snk;
};

// https://qiita.com/ta-ka/items/a023a11efe17ab097433
struct Edge {
    ll to, cost;
};


class Dijkstra {
    ll vector_count;

    vector<ll> distances;
    vector<vector<Edge>> edges;

public:
    Dijkstra(ll n) {
        vector_count = n;
        distances.resize(n, INF);
        edges.resize(n);
    }

    void insertTowWay(ll from, ll to, ll cost) {
        edges[from].push_back({to, cost});
        edges[to].push_back({from, cost});
    }

    void insert(ll from, ll to, ll cost) {
        edges[from].push_back({to, cost});
    }

    void dijkstra(ll k) {
        distances[k] = 0;  // 始点sへの最短距離は0

        priority_queue<P, vector<P>, greater<P>> que;  // 距離が小さい順に取り出せるようgreater<P>を指定
        que.push(P(0, k));
        while (!que.empty()) {
            P p = que.top();
            que.pop();
            int v = p.second;  // 更新した頂点の中で距離が最小の頂点v
            if (distances[v] < p.first) {
                continue;
            }
            for (auto e : edges[v]) {  // 頂点vから出る辺eを走査
                if (distances[e.to] > distances[v] + e.cost) {
                    distances[e.to] = distances[v] + e.cost;
                    que.push(P(distances[e.to], e.to));
                }
            }
        }
    }

    ll distance(ll to) {
        return distances[to];
    }

};

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

    s--;
    t--;
    vector<Train> trains(m);
    for (Train &train : trains) cin >> train.u >> train.v >> train.yen >> train.snk;
    for (Train &train : trains) train.u--, train.v--;

    Dijkstra dj_yen(n), dj_snk(n);
    for (Train train: trains) dj_yen.insertTowWay(train.u, train.v, train.yen);
    for (Train train: trains) dj_snk.insertTowWay(train.u, train.v, train.snk);
    dj_yen.dijkstra(s);
    dj_snk.dijkstra(t);

    vector<ll> dp(n);

    ll all = 1e15;
    rep(i, n) {
        ll yen = dj_yen.distance(i);
        ll snk = dj_snk.distance(i);
        ll cost = yen + snk;
        ll now = all - cost;
        dp[i] = now;
    }

    for (int i = n - 2; i >= 0; i--) {
        cmax(dp[i], dp[i + 1]);
    }

    for (ll l : dp) cout << l << endl;

}

Measured memory_bytes: 23328
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;

int MOD=1000000007;

int main() {
  int N,ans=0,ans2=0;
  cin >> N;
  ans=N/(double)108*(double)100;
  ans2=ans;
  ans=ans/(double)100*(double)108;
  if(ans==N){
    ans=ans/(double)108*(double)100;
    cout << ans << endl;
    return 0;
  }else{
    ans2=ans2+1;
    ans2=ans2/(double)100*(double)108;
    if(ans2==N){
      ans2=ans2+1;
      ans2=ans2/(double)108*(double)100;
      cout << ans2 << endl;
      return 0;
    }
  }
    cout << ":(" << endl;
}

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

int main () {
    int A, B, result = 0;
    char op;

    cin >> A >> op >> B;

    if(op == '+'){
        result += (A + B);
    }
    else{
        result += (A-B);
    }

    cout << result << endl;
}

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

int main(){
    long long N,M;
    cin>>N>>M;
    
    if(N==1 && M==1){cout<<1<<endl;}
    else if(N==1){cout<<M-2<<endl;}
    else if(M==1){cout<<N-2<<endl;}
    else{cout<<N*M-2*(N+M)+4<<endl;}
    
    return 0;
}


Measured memory_bytes: 256
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#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 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 complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void solve() {
	string s; int w;
    cin >> s >> w;
    int n = (int)s.size();
    for(int i = 0; i < n; i += w) {
        cout << s[i];
    }
    cout << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 256
#include <string>
#include <vector>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <utility>
#include <map>
using namespace std;


#define prec(i) cout << fixed << setprecision(i)

const long long int MOD = 1000000007;


int ctoi(char c) {
	if (c >= '0' && c <= '9')
		return c - '0';
	else
		return -1;
}

int main()
{
	string s;

	cin >> s;

	if(s == "Sunny")
		cout << "Cloudy" << endl;
	else if(s == "Cloudy")
		cout << "Rainy" << endl;
	else
		cout << "Sunny" << endl;

	return 0;

}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  int mn = (int) 1e9 + 20;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    if (a[i] <= mn) {
      mn = a[i];
      ++ans;
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 1024
N, M = map(int, input().split())

condition = set()
for i in range(M):
    s, c = map(int, input().split())
    condition.add((s, c))

ans = float("inf")
if N == 1:
    for i in range(10):
        num = str(i)
        for s, c in condition:
            if num[s-1] != str(c):
                break
        else:
            print(i)
            exit()       

for i in range(10**(N-1), 10**N):
    num = str(i)
    for s, c in condition:
        if num[s-1] != str(c):
            break
    else:
        print(i)
        exit()
print(-1)

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

double eucAlg(int a,int b);


int main(int argc, char* argv[])
{
	double a,b;	//??\??????
	double c, d;	//??????

	while(cin >> a >> b){

		c = eucAlg(a, b);

		d = a * b / c;
		cout << fixed << setprecision(0) << c << " " << d << endl;
	}
	return 0;
}

//??????????????????????????????
double eucAlg(
	int a,
	int b
	)
{
	double c;

	do
	{
		c = a % b;
		if(c == 0){
			break;
		}
		a = b;
		b = c;

	}while(1);

	return b;
}

Measured memory_bytes: 1276
#include <stdio.h>
int main()
{
int N,M,a,b,c;
scanf("%d", &N);

if(100<=N && N<=999)
{
    a=N%10;
    M=N/10;
    b=M%10;
    c=M/10;
    if(a==7 || b==7 || c==7)
    {
        printf("Yes");
    }
    else{
        printf("No");
    }
}
else{
    printf("input is not right");
}
}


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

int main(){
    unsigned long N;
    cin >> N;
    vector<long> A(N), B(N);
    for(auto &i : A)cin >> i;
    transform(A.cbegin(), A.cend(), B.begin(), labs);
    cout << accumulate(B.cbegin(), B.cend(), 0L) -
            (1 & count_if(A.cbegin(), A.cend(), [](auto a){return a < 0;}) ? *min_element(B.cbegin(), B.cend()) * 2 : 0) << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <set>

using namespace std;

typedef long long ll;

int main() {
  set<ll> s;

  ll n;
  cin >> n;
  while(n--) {
    ll i;
    cin >> i;
    s.insert(i);
  }

  ll sum = 0;
  ll q;
  cin >> q;
  while(q--) {
    ll i;
    cin >> i;
    auto it = s.find(i);
    if (it != s.end()) sum++;
  }

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 3128
def main():
    a, b, c = map(int, input().split())
    k = int(input())

    ans = 0
    for i, m in enumerate(sorted([a, b, c], reverse=True)):
        if i == 0:
            ans += m * (2 ** k)
        else:
            ans += m

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main (void)
{
  int a,b,flag = 0;
  string as,bs;
  
  cin >> a >> b;

  as = to_string(a);
  bs = to_string(b);
  string sums = as + bs;
  int sum = stoi(sums);

  for(int i = 1;i <= 317;i++){
    if(sum / i == i && sum % i == 0){
      flag = 1;
      break;
    }
  }

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

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<fstream>
using namespace std;
int main()
{
	int n,m;
	cin>>n>>m;
	int ans;
	cin>>ans;
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=m;j++)
		{
			if(m*i+(n-i*2)*j==ans)
			{
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}
	cout<<"No"<<endl;
	return 0;
}

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

#define sz(x) ((int)x.size())

using namespace std;


const int MAXN = 100 * 1000 + 23;







int n, m;
vector<int> g[MAXN];
bitset<MAXN> mark;
vector<int> d;

void dfs(int v) {
    mark[v] = true;
    d.push_back(v);
    for (auto u : g[v])
        if (!mark[u]) {
            dfs(u);
            break;
        }
}


int main() {
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        g[--u].push_back(--v), g[v].push_back(u);
    }
    for (int i = 0; i < n; i++)
        if (sz(g[i]) != 0) {
            dfs(i);
            break;
        }
    reverse(d.begin(), d.end());
    d.pop_back();
    for (int i = 0; i < n; i++)
        if (sz(g[i]) != 0) {
            dfs(i);
            break;
        }
    cout << d.size() << '\n';
    for (auto i : d)
        cout << i + 1 << ' ';
    return 0;
}

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

#define rep(a,b) for(int a = 0;a < n;a++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0 };
int dy[] = { 0,  0,  1, -1 };

int main() {
	int n;
	cin >> n;
	vector<int> v(n);
	rep(i, n)cin >> v[i];
	sort(v.begin(), v.end());
	cout << abs(v[0] - v[n - 1]) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n; scanf("%d", &n);
	std::vector<int> x(n);
	std::vector<std::vector<int>> g(n);
	for(int i = 1; i < n; i++) {
		int p; scanf("%d", &p);
		
		g[p - 1].push_back(i);
	}
	for(int i = 0; i < n; i++) scanf("%d", &x[i]);
	
	std::function<void (int&, int)> chmin = [](int& v, int x) {
		if(v == -1) {
			v = x;
			return;
		}
		if(x == -1) return;
		v = std::min(v, x);
	};
	
	bool ans = true;
	const int INF = -1;
	auto dp = make_v<int>(n, 2);
	std::function<void (int)> solve = [&](int v) {
		for(auto e: g[v]) solve(e);
		
	//	cout << "----------------==" << v + 1 << "==-----------------" << endl;
		if(g[v].size() == 0) {
			dp[v][0] = dp[v][1] = 0;
			return;
		}
		
		for(int color = 0; color < 2; color++) {
			auto dp2 = make_v<int>(g[v].size() + 1, x[v] + 1);
			for(int i = 0; i < dp2.size(); i++) {
				for(int j = 0; j < dp2[i].size(); j++) dp2[i][j] = INF;
			}
			dp2[0][0] = 0;
			
			for(int i = 0; i < g[v].size(); i++) {
				int e = g[v][i];
				for(int j = 0; j < dp2[i].size(); j++) {
					if(dp2[i][j] == INF) continue;

					{
						if(j + x[e] <= x[v]) {
							chmin(dp2[i + 1][j + x[e]], dp2[i][j] + dp[e][color]);
						}
					} {
						if(j + dp[e][1 - color] <= x[v]) {
							chmin(dp2[i + 1][j + dp[e][1 - color]], dp2[i][j] + x[e]);
						}
					}
				}
			//	for(auto v: dp2[i + 1]) cout << v << " "; cout << endl;
			}
			
			int ret = 1 << 30;
			for(int i = 0; i <= x[v]; i++) chmin(ret, dp2[g[v].size()][i]);
			if(ret == (1 << 30)) {
				ans = false;
				return;
			}
			dp[v][color] = ret;
		//	cout << ret << endl;
		}
	};
	solve(0);
	
//	cout << "dp-------------------------OOOOO" << endl;
//	for(int i = 0; i < n; i++) cout << i + 1 << ": " << dp[i][0] << " " << dp[i][1] << endl;
	
	if(ans) printf("POSSIBLE\n");
	else printf("IMPOSSIBLE\n");
	return 0;
}


Measured memory_bytes: 1344