akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H, W;
  cin >> H >> W;
  vector<vector <char>> masu(H, vector<char>(W));
  for (int i=0; i<H; i++){
    for (int j=0; j<W; j++){
      cin >> masu.at(i).at(j);
    }
  }
  //for(int i=0; i<H; i++){
  //  for(int j=0; j<W; j++){
  //    cout << masu.at(i).at(j);
  //    if(j == W-1){
  //      cout << endl;
  //    }
  //  }
  //}
  //まず行単位で全部が.を見つける
  vector<int> find_all_white_H(H, 0);
  //for(int i=0; i<H; i++){
  //  cout << find_all_white_H.at(i);
  //}
  for (int i=0; i<H; i++){
    int count = 0;
    for (int j=0; j<W; j++){
      if (masu.at(i).at(j) == '.'){
        count += 1;
      }
    }
    if (count == W){
      find_all_white_H.at(i) = 1;
    }
  }
  //for(int i=0; i<H; i++){
  //  cout << find_all_white_H.at(i);
  //}
  //列単位で全部.を見つける
  int W_sum = 0;
  vector<int> find_all_white_W(W, 0);
  for(int i=0; i<W; i++){
    int count = 0;
    for (int j=0; j<H; j++){
      if (masu.at(j).at(i) == '.'){
        count += 1;
      }
    }
    if (count == H){
      find_all_white_W.at(i) = 1;
      W_sum += 1;
    }
  }
  //出力
  for(int i=0; i<H; i++){
    if(find_all_white_H.at(i) == 1){
      continue;
    }
    for(int j=0; j<W; j++){
      if(find_all_white_W.at(j) == 0){
        cout << masu.at(i).at(j);
      }
      if(j == W-1){
        cout << endl;
      }
    }
  }
}

Measured memory_bytes: 256
import javax.print.DocFlavor;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.util.*;

public class Main {

    //グローバル変数を定義
    List<char[]> list = new ArrayList<>();

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

    void run() {
        Scanner sc = new Scanner(System.in);
        char[] input = sc.next().toCharArray();
        Map<String, Integer> map = new HashMap<>();

        boolean check = true;

        for(char c: input){
            String s = String.valueOf(c);
            if(map.keySet().contains(s)){
                map.put(s, map.get(s)+1);
            } else {
                map.put(s, 1);
            }
        }

        for(int i: map.values()){
            if(i % 2 != 0){
                check = false;
                break;
            }
        }

        if(check) System.out.println("Yes");
        else System.out.println("No");
    }
}


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

#define Q int t; scanf("%d", &t); for(int q=1; q<=t; q++)
typedef unsigned long long int lli;
typedef pair<int, int> pi;

lli ones[70];
lli zeros[70];

int main()
{
    int n;
    cin >> n;
    while(n--){
        lli x;
        cin >> x;
        bitset<61> b(x);
        for(int i=0; i<61; i++){
            if(b[i]) ones[i]++;
            else zeros[i]++;
        }
    }
    lli sum = 0, mod = 1000000007;
    for(int i=0; i<61; i++){
        ones[i] = (zeros[i]*ones[i])%mod;
    }
    lli mul[64] = {1};
    for(int i=1; i<64; i++){
        mul[i] = (mul[i-1] << 1) % mod;
    }
    for(int i=0; i<63; i++){
        lli x = (ones[i]*mul[i]) % mod;
        sum = (sum+x) % mod;
    }
    //cout << mul << endl;

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
  
#define N 10000
  
int keisan(int);
int main(){
  int i,j,num;
  int S[N];
  int count = 0;
  while(1){
    scanf("%d",&num);
    if(num >= 1 && num <= N)break;
  }
  for(i = 0;i<num;i++){
    scanf("%d", &S[i]);
  }
  for(i = 0;i<num;i++){
    if(keisan(S[i]) == 1)count++;
       }
    printf("%d\n",count);
  
    return 0;
  
  }
int keisan(int a){
  int i;
  if(a==2)return 1;
  if(a < 2 || a%2 == 0)return 0;
  i = 3;
  while(i <= sqrt(a)){
    if(a%i == 0)return 0;
    i = i+2;
  }
  return 1;
}



Measured memory_bytes: 2140
import math

K = int(input())
A, B = input().split()

A = int(A)
B = int(B)

if A % K == 0 or B % K == 0:
	print('OK')
elif math.floor(B / K) - math.floor(A / K) >= 1:
	print('OK')
else:
	print('NG')

Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int MOD = 1e9+ 7;
const int INF = 2e18;

signed main() {
    int X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;
    vector<int> p(A), q(B), r(C);
    cin >> p >> q >> r;
    multiset<int> eat;
    sort(p.rbegin(), p.rend());
    sort(q.rbegin(), q.rend());
    sort(r.rbegin(), r.rend());
    for (int i = 0; i < X; i++) eat.insert(p[i]);
    for (int i = 0; i < Y; i++) eat.insert(q[i]);
    int ans = accumulate(eat.begin(), eat.end(), 0LL);
    int temp = ans;
    for (auto add : r) {
        eat.insert(add);
        int remove = *eat.begin();
        eat.erase(eat.begin());
        temp += add - remove;
        ans = max(ans, temp);
    }
    cout << ans << endl;
}


Measured memory_bytes: 11008
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;

int main(){
	int H,W;
	cin>>H>>W;
	char c[100][100];
	rep(i,H)rep(j,W)cin>>c[i][j];
	rep(i,H){
		rep(j,W)cout<<c[i][j];
		cout<<endl;
		rep(j,W)cout<<c[i][j];
		cout<<endl;
	}
}

Measured memory_bytes: 256
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn is_same_number(a: i32, b: i32, c: i32) -> bool {
    a == b && a == c
}

fn is_sequense_number(a: i32, b: i32, c: i32) -> bool {
    a + 1 == b && b + 1 == c
}

fn is_good_set(a: i32, b: i32, c: i32) -> bool {
    is_same_number(a, b, c) || is_sequense_number(a, b, c)
}

fn remove_good_set(vec: &mut Vec<i32>) {
    let vecsize: usize = vec.len();
    let mut flag: bool = false;
    //println!("{}", vecsize);
    for i in 0..vecsize {
        for j in i + 1..vecsize {
            for k in j + 1..vecsize {
                //println!("{}, {}, {}", i, j, k);
                if is_good_set(vec[i], vec[j], vec[k]) {
                    vec.remove(k);
                    vec.remove(j);
                    vec.remove(i);
                    flag = true;
                }
                if flag {
                    break;
                }
            }
            if flag {
                break;
            }
        }
        if flag {
            break;
        }
    }
}

fn main() {
    let n: i32 = read();
    for i in 0..n {
        let mut vec_num: Vec<i32> = read_vec();
        let vec_mark: Vec<String> = read_vec();

        // modify the vector for simplification
        for i in 0..9 as usize {
            if vec_mark[i] == "G" {
                vec_num[i] = vec_num[i] + 10;
            } else if vec_mark[i] == "B" {
                vec_num[i] = vec_num[i] + 20;
            }
        }

        vec_num.sort();
        let mut ans: i32 = 0;
        for i in 0..3 {
            remove_good_set(&mut vec_num);
        }
        if vec_num.len() == 0 {
            ans = 1;
        }

        println!("{}", ans);
        //println!("----");
    }
}



Measured memory_bytes: 5048
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int i,j,n = sc.nextInt();
		double ptx[] = new double [n];
		double pty[] = new double [n];
		double dt=0.0;

		for(i=0;i<n;i++){
			ptx[i] = sc.nextDouble();
		}
		for(i=0;i<n;i++){
			pty[i] = sc.nextDouble();
		}
		for(i=0;i<4;i++){
			dt = 0.0;
			if(i == 0){
				for(j=0;j<n;j++){
					dt += Math.abs((ptx[j]-pty[j]));
				}
				System.out.printf("%.6f\n", dt);
			}
			else if(i == 1){
				for(j=0;j<n;j++){
					dt += Math.pow(Math.abs((ptx[j]-pty[j])),2.0);
				}
				dt = Math.sqrt(dt);
				System.out.printf("%.6f\n", dt);
			}
			else if(i == 2){
				for(j=0;j<n;j++){
					dt += Math.pow(Math.abs((ptx[j]-pty[j])),3.0);
				}
				dt = Math.cbrt(dt);
				System.out.printf("%.6f\n", dt);
			}
			else{
				for(j=0;j<n;j++){
					if(dt < Math.abs((ptx[j]-pty[j]))){
						dt = Math.abs((ptx[j]-pty[j]));
					}

				}
				System.out.printf("%.6f\n", dt);
			}
		}

		sc.close();


	}

}


Measured memory_bytes: 29212
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#define all(v) v.begin(),v.end()
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
	int n;
	int sum=0;
	int l;
	int maxl = 0;
	cin >> n;

	rep(i, n) {
		cin >> l;
		sum += l;
		maxl = max(maxl, l);
	}

	if (sum > maxl * 2)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int a = 0;a < i;a++){for(int b = 0;b < j;b++)cerr << v[a][b] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int dp[500100];
int pre[500100];
int nxt[500100];

int main()
{
	int n;
	string str;
	cin >> n >> str;
	str = '0'+ str +'0';n++;
	
	pre[0] = 0;
	nxt[n] = n;
	
	rep(i,1,n)
	{
		if(str[i] == '0')
		{
			pre[i] = i;
		}
		else
		{
			pre[i] = pre[i-1];
		}
	}
	rrep(i,n-1,0)
	{
		if(str[i] == '0')
		{
			nxt[i] = i;
		}
		else
		{
			nxt[i] = nxt[i+1];
		}
	}
	
	
	rep(i,1,n)
	{
		dp[i+1] = max(dp[i],dp[i+1]);
		
		if(str[i] == '1')
		{
			
			if(str[pre[i]-1] == '1')
			{
				int tmp = i - pre[i];
				dp[i+1] = max(dp[pre[i]-1]+tmp,dp[i+1]);
			}
			if(str[nxt[i]+1] == '1')
			{
				int tmp = nxt[i] - i;
				dp[nxt[i]+2] = max(dp[nxt[i]+2],dp[i]+tmp);
			}
		}
	}
	
	SHOW1d(pre,n+2);
	SHOW1d(nxt,n+2);	
	SHOW1d(dp,n+2);
	
	cout << dp[n] << endl;
			
			
			
	
	return 0;
}

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

vector<vector<int>> adj;
int mod = 1000000007;

int mul(int a, int b)
{
    return (long long) a * b % mod;
}

// returns a pair, where first number denotes number of ways to become a black color node and second denotes number of ways to become
// a white color node.
pair<int, int> dfs(int u, int parent)
{
    int white = 1; // all children white
    int some_black = 0; // some children are black
    for(int i = 0; i < adj[u].size(); i++)
    {
        int v = adj[u][i];
        if(v == parent)
            continue;
        pair<int, int> p = dfs(v, u);
        int orig = white;
        white = ((long long)white*p.second) % mod;
        some_black = (mul(orig, p.first) + mul(some_black, (p.first + p.second) % mod)) % mod;
    }
    return {white, (white + some_black) % mod};
}

int main()
{
    int n;
    cin >> n;
    adj = vector<vector<int>> (n);
    for(int i = 0; i < n - 1; i++)
    {
        int x, y;
        cin >> x >> y;
        adj[x - 1].push_back(y - 1);
        adj[y - 1].push_back(x - 1);
    }
    pair<int, int> p = dfs(0, -1);
    int ans = (p.first + p.second) % mod;
    cout << ans;
    return 0;
}

Measured memory_bytes: 11264
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;

const int INF = 0x3f3f3f3f;
const int MOD = 1000000007;
const int dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, -1, 0 };

int main() {
	char ans[3][20] = { "Positive", "Negative", "Zero" };
	int a, b, idx;
	cin >> a >> b;
	if(a <= 0 && 0 <= b) idx = 2;
	else if(0 <= a) idx = 0;
	else if((b-a)%2==0) idx = 1;
	else idx = 0;
	cout << ans[idx] << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  size_t n; std::cin >> n;
  std::vector<int> a(n);
  std::generate(a.begin(), a.end(), []{int x; std::cin >> x; return x;});
  auto make_l = [&] (const std::vector<int>&a) {
    std::vector<long long> l(n + 1, 0);
    std::vector<int> b;
    std::transform(a.begin(), a.end(), std::back_inserter(b), [](auto x){
      if (x < 0) return x;
      return -2 * x;
    });
    l.at(1) = a.at(0) > 0;
    std::stack<size_t> stk;
    for (size_t i = 1; i < n; i++) {
      l.at(i + 1) = l.at(i) + (a.at(i) > 0);
      long long x = b.at(i - 1), y = b.at(i);
      if (x <= y) {
        while (x <= 4LL * y) {
          stk.push(i);
          y *= 4LL;
        }
      } else {
        while (x > y) {
          x *= 4LL;
          long long j = 0;
          if (!stk.empty()) j = stk.top(), stk.pop();
          l.at(i + 1) += (i - j) * 2u;
        }
      }
    }
    return l;
  };
  auto b = [&]{
    auto b = a;
    std::reverse(b.begin(), b.end());
    std::for_each(b.begin(), b.end(), [](auto& x){x = -x;});
    return b;
  }();
  auto l = make_l(a), r = make_l(b);
  std::reverse(r.begin(), r.end());
  long long ret = 1LL << 60;
  for (size_t i = 0; i <= n; i++) {
    ret = std::min(ret, l.at(i) + r.at(i));
  }
  std::cout << ret << std::endl;
  return 0;
}

Measured memory_bytes: 6756
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <numeric>
#include <math.h>

using namespace std;
void func()
{
	double D,T,S;
	cin >> D>>T>>S;
	
	if(D/S <= T)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

}

int main() {
//	while(1)
	func();
	return 0;
}


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

int cnt = 0;
int N;
void dfs(string S) {
    if (S.size() > 0 && stol(S) > N) return;
    if (S.find('7') != string::npos &&
        S.find('5') != string::npos &&
        S.find('3') != string::npos) {
            cnt++;
    }
    dfs(S + '7');
    dfs(S + '5');
    dfs(S + '3');
}


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

    cin >> N;
    dfs("");
    cout << cnt << endl;


    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>
#include<queue>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define dump(a) cout << a << endl; 

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

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0; true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

void ansYes(bool a) {
	if (a == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

void ansYES(bool a) {
	if (a == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Int euclidean_gcd(Int a, Int b) {
	while (true) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

typedef pair<int, int> pai;


//ここまでライブラリ
//ここから本文

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	a = a + b;
	c = c + d;
	if (a > c) dump("Left") 
	else if (a < c){
		dump ("Right")
	}
	else {
		dump("Balanced");
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vchar = vector<char>;
using vvchar = vector<vchar>;
using vp = vector<P>;
using vpp = vector<pair<P, P>>;
using vvp = vector<vp>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
istream &operator>>(istream &is, P &a)
{
    return is >> a.first >> a.second;
}
ostream &operator<<(ostream &os, const P &a) { return os << "(" << a.first << "," << a.second << ")"; }

template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

#pragma region UnionFind
struct UnionFind
{
    vector<int> d;
    // d[x] is the index of the parent of x
    // d[x] is -size if x is a root

    UnionFind(int n) : d(vector<int>(n, -1)) {}
    int root(int x)
    {
        if (d[x] < 0)
        {
            return x;
        }
        return d[x] = root(d[x]);
    }

    bool unite(int x, int y)
    {
        x = root(x);
        y = root(y);
        if (x == y)
        {
            return false;
        }
        if (d[x] > d[y])
            swap(x, y); // x always bigger tree

        d[x] += d[y];
        d[y] = x;
        return true;
    }

    bool same(int x, int y)
    {
        return root(x) == root(y);
    }
    int size(int x) { return -d[root(x)]; }
};
#pragma endregion

int solve(map<int, int> ax, map<int, int> ay, set<P> st)
{
    P mx(0, 0), my(0, 0);
    for (P p : ax)
    {
        if (p.second > mx.second)
        {
            mx = p;
        }
    }
    for (P p : st)
    {
        if (p.second == mx.first)
        {
            ay[p.first]--;
        }
    }
    for (P p : ay)
    {
        // P q = {p.first, mx.first};
        // int sub = st.find(q) != st.end() ? -1 : 0;
        if (p.second > my.second)
        {
            my = p;
        }
    }
    int ans = mx.second + my.second;

    return ans;
}

int main()
{
    int h, w, m;
    cin >> h >> w >> m;

    UnionFind uft(m);
    vp a(m);
    map<int, int> ay, ax;
    set<P> st;
    rep(i, m)
    {
        int y, x;
        cin >> y >> x;
        ay[y]++;
        ax[x]++;
        P p = P(y, x);
        st.emplace(p);
    }

    int ans = solve(ax, ay, st);

    swap(ax, ay);
    set<P> st2;
    for (P p : st)
    {
        swap(p.first, p.second);
        st2.emplace(p);
    }
    ans = max(ans, solve(ax, ay, st2));

    cout << ans << endl;

    return 0;
}

// 011
// 011

Measured memory_bytes: 105160
def main():
    char_list = 'abcdefghijk'
    N = int(input())

    def dfs(s, n=N, n_char=0):
        if n == 0:
            print(s)
            return
        # 既出の文字
        for c in char_list[:n_char]:
            dfs(s + c, n - 1, n_char)
        # 新しい文字
        dfs(s + char_list[n_char], n - 1, n_char + 1)

    dfs('')


if __name__ == '__main__':
    main()

Measured memory_bytes: 9248
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
double dp[1<<12][12];
int main()
{
	string s;
	while(getline(cin,s))
	{
		for(int i=0;i<(1<<12);i++)for(int j=0;j<12;j++)dp[i][j]=INF;
		int n=0,sum,a[15];
		stringstream ss;
		ss << s;
		ss >> sum;
		while(!ss.eof())ss >> a[n++];
		for(int i=0;i<n;i++)dp[1<<i][i]=a[i];
		for(int i=0;i<(1<<n);i++)
		{
			for(int j=0;j<n;j++)
			{
				if((i>>j)&1)continue;
				for(int k=0;k<n;k++)
				{
					dp[i|1<<j][j]=min(dp[i|1<<j][j],dp[i][k]+sqrt(((a[k]+a[j])*(a[k]+a[j])-(a[k]-a[j])*(a[k]-a[j]))));
				}
			}
		}
		double ans=INF;
		for(int i=0;i<n;i++)ans=min(ans,dp[(1<<n)-1][i]+a[i]);
		if(ans<=sum)cout << "OK" << endl;
		else cout << "NA" << endl;
	}
	return 0;
}

Measured memory_bytes: 1600
# -*- coding: utf-8 -*-
# A

import sys
from collections import defaultdict, deque
from heapq import heappush, heappop
import math
import bisect
input = sys.stdin.readline

# 再起回数上限変更
# sys.setrecursionlimit(1000000)

n = int(input())

print(n**3)


Measured memory_bytes: 38256
from collections import *
from itertools import *
from bisect import *
from heapq import *
import copy
#import math

#N=int(input())
#X,Y=map(int,input().split())
#S=list(map(int,input().split()))
#S=[list(map(int,input().split())) for i in range(N)]



N,M=map(int,input().split())
sc=[list(map(int,input().split())) for i in range(M)]
dic={}
for s,c in sc:
    if not s in dic:
        dic.update({s:c})
    else:
        if dic[s]!=c:
            print(-1)
            exit()
if not 1 in dic:
    data="1"
    Z=2
else:
    Z=1
    data=""

if N==1 and not dic:
    print(0)
    exit()
if N>1 and 1 in dic and dic[1]==0:
    print(-1)
    exit()

for i in range(Z,N+1):
    if i in dic:
        data+=str(dic[i])
    else:
        if data:
            data+="0"
if data:
    print(data)
else:
    print(-1)
#print(Counter(sc))


Measured memory_bytes: 38384
#ifndef LOCAL
#pragma GCC optimize("O2")
#endif
#include <iostream>
#include <vector>
#include<algorithm>
using namespace std;

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

   int range = A - B * 2;

   range = max(range, 0);

   cout << range << endl; 
}

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

#define loop(i,a,b) for(int i=(a); i<int(b); i++)
#define rep(i,b) loop(i,0,b)
#define iter(it,c) for(auto it=c.begin(); it!=c.end(); it++)
typedef vector<int> vi;
typedef vector<vi> vvi;

int main(){
    int n, m;
    string s;
    while (cin >> n >> m >> s && n){
        vi c(m);
        int ans = 0;
        int l = 2 * n + 1;
        rep(i, m){
            if (s[i] == 'I'){
                if (i != 0 && s[i - 1] == 'O'){
                    c[i] = c[i - 1] + 1;
                }
                else{
                    c[i] = 1;
                }
            }
            else{
                if (i != 0 && s[i - 1] == 'I'){
                    c[i] = c[i - 1] + 1;
                }
            }
            if (s[i] == 'I' && c[i] >= l) ans++;
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 6060
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	/*/TODO:!!!!!!!テスト用!!!!!!!!!
	sc = bufio.NewScanner(strings.NewReader(`
										`))
	//TODO:!!!!!!!テスト用!!!!!!!!!*/

	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!caution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	//fmt.Fprintln(out, "[DEBUG]", time.Now())

	x := nextInt()

	ans := "No"

	if x >= 30 {
		ans = "Yes"
	}

	//fmt.Fprintln(out, "[DEBUG]", a)
	fmt.Fprintln(out, ans)

}

// 挿入ソート配列
type slist struct {
	l []int
}

func makeSlist() slist {
	return slist{[]int{}}
}

func (s *slist) add(a int) {
	pos := sort.Search(len(s.l), func(i int) bool { return s.l[i] >= a })
	if pos < len(s.l) {
		s.l = append(s.l[:pos+1], s.l[pos:]...)
		s.l[pos] = a
	} else {
		s.l = append(s.l, a)
	}
}
func (s slist) contains(a int) bool {
	pos := sort.Search(len(s.l), func(i int) bool { return s.l[i] >= a })
	return pos < len(s.l) && s.l[pos] == a
}

//------------------------------------------------------------------------------

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

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

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func chars(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

func printArray(a []int) {
	for i := 0; i < len(a); i++ {
		if i >= 1 {
			fmt.Fprint(out, " ")
		}
		fmt.Fprint(out, a[i])
	}
	fmt.Fprintln(out)
}

func absInt(x int) int {
	return int(math.Abs(float64(x)))
}
func minInt(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func maxInt(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func log10(x int) float64 {
	return math.Log10(float64(x))
}


Measured memory_bytes: 1808
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int N;
  cin >> N;
  int ans = 0;
  int check = 0;
  for ( int i = 0; i < N; i++) {
    int H;
    cin >> H;
    if ( check <= H ) {
      check = H;
      ans++;
    }
  }
  cout << ans << endl;
}

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

struct node{
  unsigned int key;
  struct node *nxt;
  struct node *prv;
};

typedef struct node * NodePointer;

NodePointer nu;

NodePointer listSearch(int key) {
  NodePointer c = nu->nxt;
  while( c != nu && c->key != key ) {
    c = c->nxt;
  }
  return c;
}

void mos(){
  nu = malloc(sizeof(struct node));
  nu->nxt = nu;
  nu->prv = nu;
}

void printList(){
  NodePointer c = nu->nxt;
  int m = 1;
  while(1){
    if ( c == nu ) break;
    if ( m == 0)  printf(" ");
    printf("%d", c->key);
    c = c->nxt;
    m = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  t->prv->nxt = t->nxt;
  t->nxt->prv = t->prv;
}

void delete1(){
  NodePointer t = nu->nxt;
  if ( t == nu ) return;
  deleteNode(t);
}

void delete2(){
  NodePointer t = nu->prv;
  if ( t == nu ) return;
  deleteNode(t);
}

void delete(int key){
  NodePointer t = listSearch(key);
  if ( t == nu ) return;
  deleteNode(t);
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;
  x->nxt = nu->nxt;
  nu->nxt->prv = x;
  nu->nxt = x;
  x->prv = nu;
}

int main(){
  int key, n, i;
  int size = 0;
  char A[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  mos();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d",A, &key);
    if(!( 0 <= key && key <= 2000000000)){
      printf("error");
    }
    if ( A[0] == 'i' ) {
      insert(key);
      np++;
      size++;
    }
    else if ( A[0] == 'd' ) {
      if (strlen(A) > 6){
	if ( A[6] == 'F' ) delete1();
	else if ( A[6] == 'L' ) {
	  delete2();
	}
      }
      else {
	delete(key); nd++; 
      }
      size--;
    }
    if ( size > 1000000 ) {
      printf("error");
    }
  }

  
  if(!( np+nd <= 2000000)){
    printf("error");
  }
  if(!( nd <= 20)){
    printf("error");
  }
  printList();


  return 0;
}



Measured memory_bytes: 36100
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define vlli vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vplli vector< pair< ll,ll> >
#define plli pair< ll,ll >
#define vps vector< pair< string, string> >
#define vpi vector< pair< int, int> >
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n) for(ll i=a;i<n;i++)
#define forr(i,n,a) for(ll i=n-1;i>=a;i--)
#define scan(arr,a,n) for(int i=(a);i<(n);i++)cin>>(arr)[i];
#define print(arr,a,n) for(int i=(a);i<(n);i++)cout<<(arr)[i]<<' ';

const ll inf = 1e18;

ll add(ll x, ll y) {ll res = x + y; return (res >= mod ? res - mod : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= mod ? res % mod : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + mod : res);}
ll power(ll x, ll y) {ll res = 1; x %= mod; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}
ll mod_inv(ll x) {return power(x, mod - 2);}

int main(){
	fast;
	ll n;
	cin>>n;
	ld a[n], ans = 0;
	forn(i, 0, n){
		cin>>a[i];
		a[i] = (1.0)/a[i];
		ans+=a[i];
	}
	cout<<fixed<<setprecision(10)<<(1/ans)<<endl;

}

Measured memory_bytes: 3760
#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<int,int>;

int main() {
    vector<ll> A(3);
    cin >> A[0] >> A[1] >> A[2];
    if (A[0] % 2 == 0 || A[1] % 2 == 0 || A[2] % 2 == 0)
    {
        cout << 0 << endl;
        return 0;
    }
    sort(A.begin(), A.end());
    ll ans = A[0] * A[1];
    cout << ans << endl;

  return 0;
}

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

using namespace std;

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

#define fr(i, n) for (ll i = 0; i < n; i++)
#define fr1(i, n) for (ll i = 1; i <= n; i++)
#define pb(x) push_back(x)
#define l(s) s.size()
#define as(a) sort(a, a + n)
#define ds(a) sort(a, a + n, greater<int>())
#define vas(v) sort(v.begin(), v.end());
#define inf 1e18
#define nl cout << endl;
#define F first
#define S second
typedef vector<ll> vi;
typedef pair<int, int> pi;

int infi = 1000000007;

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

    string s;
    cin>>s;

    ll ans =0;

    for(auto it : s){
        ans+=(it - 48);
    }

    if(ans%9 == 0){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
    return 0;
}

Measured memory_bytes: 3732
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
using namespace std;

class DPredictionAndRestriction {
 public:
  void solve(std::istream &in, std::ostream &out) {
    int N, k;
    string T;
    in >> N >> k;

    vector<int> p(3);
    forn(i, 3)in >> p[i];

    in >> T;

    int ans = 0;

    forn(a, k) {

      string t;
      for (int i = a; i < N; i += k)t += T[i];
      int n = t.size();

      vector<vector<int> > dp(n + 1, vector<int>(3, 0));

      forn(i, n) {
        int w = -1;
        if (t[i] == 's')w = 0;
        else if (t[i] == 'p') w = 1;
        else if (t[i] == 'r')w = 2;

        forn(j, 3)
          forn(k, 3) if (j != k) {
              if (k == w)
                dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + p[k]);
              else
                dp[i + 1][k] = max(dp[i + 1][k], dp[i][j]);
            }
      }
      ans += *max_element(all(dp[n]));
    }
    out << ans << endl;
  }

};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  DPredictionAndRestriction solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 5888
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

	int root(int x)
	{
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y)
	{
		return root(x) == root(y);
	}

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
int gcd(int a, int b)
{
	if (a%b == 0)return b;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main()
{
	ll n; cin >> n;
	if (n % 2)cout << 0 << endl;
	else
	{
		n /= 2;
		ll res = 0;
		ll d = 5;
		while (n / d > 0)
		{
			res += n / d;
			d *= 5;
		}
		cout << res << endl;
	}
}

Measured memory_bytes: 3628
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
using ll=long long;
using ld=long double; 
using namespace std;
//const int INF = 7+(1e+9);
ll GCD(ll x, ll y)
{
    if (y == 0)
    {
        return x;
    }
    else
    {
        return GCD(y, x % y);
    }
}
ll LCM(ll x, ll y)
{
    return x / GCD(x, y) * y;
}
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll MOD=1e9+7;

int main(){
    int n;
    cin>>n;
    vector<int> vec(n);
    vector<int> vec1(n);
    for(int i=0;i<n;i++){
        cin>>vec[i];
    }
    for(int i=0;i<n;i++){
        cin>>vec1[i];
    }
    int MAX=0;
    
    for(int i=0;i<n;i++){
        int sum=0;
        for(int j=0;j<=i;j++){
            sum+=vec[j];
        }
        for(int j=i;j<n;j++){
            sum+=vec1[j];
        }
        MAX=max(MAX,sum);
    }
    cout<<MAX<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <deque>

using namespace std;

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

	string s, t;
	cin >> s >> t;

	sort(s.begin(), s.end());
	sort(t.begin(), t.end());
	reverse(t.begin(), t.end());

	if (s < t) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
            #include <bits/stdc++.h>
            #include <cstring>
            #include <cstdlib>
            #include <utility>
            #include <set>
            #include <vector>
            #include <algorithm>
            #include <iomanip>
            using namespace std;
            typedef long long ll;
            long double pie = 3.1415926535;
            int main() {
                //ll t;
                //cin >> t;
                //while(t--)
                //{
                    ll a,b,h,m;
                    cin >> a >> b >> h >> m;
                    long double minute=m;
                    long double hour=h*5+((minute/60.0)*5);
                    long double angle=(pie/180)*(abs(hour-minute)*6.0);
                    long double result=sqrt((a*a+b*b)-(cos(angle)*(2*a*b)));
                    cout << setprecision(20) << result << endl;
                //}
                return 0;
            }

Measured memory_bytes: 4152
def main():
    R, G, B, N = map(int, input().split())
    ans = 0
    for r in range(N // R + 1):
        for g in range(N // G + 1):
            if r * R + g * G > N:
                break
            tmp = r * R + g * G
            b = (N - tmp) // B
            if (N - tmp) % B == 0 and N == tmp + b * B:
                ans += 1
                

    print(ans)


if __name__ == "__main__":
    main()

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

int main(void) {
    string input;
    cin >> input;
    ll tmp = 0;
    ll diff = 0;
    for(int i=0; i<input.size(); i++) {
        if(input[i] == 'W') {
            tmp += i;
            tmp -= diff;
            diff++;
        }
    }
    cout << tmp << endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define lli long long int
#define pb push_back
#define mod2 998244353
#pragma GCC optimize("-O2")
#define mod3 127
#define mod 1000000007
#define MAXN 1000000000
#define v32 vector<int>
#define v64 vector<lli>
#define v1024 vector<vector<int>>
#define v4096 vector<vector<lli>>
#define vt vector
#define f(x, y, z) for (lli x = y; x < z; x++)
#define fd(x, y, z) for (lli x = y; x > z; x--)
#define lb lower_bound
#define ld long double
#define m64 map<lli, lli>
#define m32 map<int, int>
#define m64it map<lli, lli>::iterator
#define m32it map<int, int>::iterator
#define fastio                    \
ios_base::sync_with_stdio(0); \
cin.tie(0);                   \
cout.tie(0)
#define ist insert
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define p_q priority_queue
#define min_p_q priority_queue<int, vt<int>, greater<int>>
using namespace std;
using namespace __gnu_pbds;
lli tmod(lli x, lli y)
{
    return (x % y + y) % y;
}
template <typename T>
void DEBUG_ARR(vt<T> a)
{
    f(i, 0, a.size()) cout << a[i] << " ";
    cout << "\n";
}
lli power(lli x, lli y) 
{
    lli res = 1;  
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x)%mod; 
        y = y>>1; 
        x = (x*x)%mod;
    }
    if(res<0)res+=mod;
    return res; 
}

int main()
{
    fastio;
    int n;
    cin>>n;
    int p[n];f(i,0,n)cin>>p[i];
    int ans=1;
    int mn=p[0];
    f(i,1,n){
        if(p[i]<mn){
            mn=p[i];
            ans++;
        }
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(void)
{
    int i,a,b,c,d,e;
	while(1){
	scanf("%d",&a);
	if(a==0) break;
	scanf("%d",&b);
	e=0;
	for(i=0;i<b;i++){
	scanf("%d %d",&c,&d);
	e+=d-c;
	}
	if(a<=e){
	printf("OK\n");
	}
	else if(a>e){
	printf("%d\n",a-e);
	}
	}
	return 0;
	}

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

	

int main()
{

 	ll n;
 	cin>>n;
 	ll ans=0;
 	if(n&1)
 	  {
 	  	cout<<"0";
	   }
	else{
		
		n=n/2;
		while(n/5)
		{
			ans=ans+n/5;
			n=n/5;
			
			
		}
		
		cout<<ans;
	}
 	cout<<endl;
 }

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

int main() {
	int n; cin>>n;
	    int c1=0,c2=0,c3=0,c4=0;
    while(n--)
    {
        string s;
        cin>>s;
        if(s=="AC") c1++;
        else if(s=="WA") c2++;
         else if(s=="TLE") c3++;
            else if(s=="RE") c4++;
    }
    
    cout<<"AC x "<<c1<<endl;
    cout<<"WA x "<<c2<<endl;
    cout<<"TLE x "<<c3<<endl;
    cout<<"RE x "<<c4<<endl;
	return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>
#include<string.h>
#include<cstdio>
#include<cstdlib>
#include<cstring>
struct node
{  int key;
   node *next,*prev;
};
node *head;
node *listsearch(int key)
{  node *cur=head->next;
   while(cur!=head&&cur->key!=key) 
     cur=cur->next;
   return cur;
}
void init()// 初始化双向链表，即生成空结点为表头，让head.next和head.prev都指向head 
{  head=new node;
   head->next=head;
   head->prev=head;
}
void printlist()
{  node *cur=head->next;
   int isf=0;
   while(1)
   {  if(cur==head) break;
      if(isf++>0) printf(" ");
      printf("%d",cur->key);
      cur=cur->next;
   }
   printf("\n");
}
void deletenode(node *t)//删除相应结点 
{  if(t==head)  return;//如果t为头结点时不做处理
   t->prev->next=t->next;//t的前一个结点的next指向t的后一个结点 
   t->next->prev=t->prev;//t的后一个结点的prev指向t的前一个结点 
   delete t; 
}
void deletefirst()// 删除头结点next所指向的结点 
{  deletenode(head->next); 
}
void deletelast()// 删除头结点prev 所指向的结点 
{  deletenode(head->prev); 
}
void deletekey(int key)// 删除搜索到的结点 
{  deletenode(listsearch(key));
}
void insert(int key)//新的结点总是在头结点的后面 
{  node *x=new node;
   x->key=key;
   x->next=head->next;
   head->next->prev=x;
   head->next=x;
   x->prev=head;
}
int main()
{  int key,n,i;
   int size=0;
   char com[20];
   int np=0,nd=0;
   scanf("%d",&n);
   init();
   for(i=0;i<n;i++)
   {  scanf("%s%d",&com,&key);
      if(com[0]=='i')
      {  insert(key);
         np++;
         size++;
      }
      else if(com[0]=='d')
      {  if(strlen(com)>6)
         {  if(com[6]=='F')  deletefirst();
            else if(com[6]=='L')  deletelast();
         }
         else
        {  deletekey(key);
           nd++;
        }
      }
      size--;
   }
   printlist();
} 


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

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

    int max_len = 0;

    vector<vector<int>> dp(n+9, vector<int>(n+9, 0));

    rep2(i,1,n)
        if(s[0] == s[i])
        {
            dp[i][0] = 1;
            dp[0][i] = 1;
            max_len = 1;
        }
            
    rep2(i,1,n-1)
        rep2(j,i+1,n)
        {
            if(s[i] == s[j])
            {
                dp[i][j] = dp[i-1][j-1] + 1;
                if(dp[i][j] > max_len && j-i >= dp[i][j])
                    max_len = dp[i][j];
            }
        }

    cout << max_len << endl;
    return 0;
}

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

namespace ABC
{
    using System.Collections.Generic;
    using System.Runtime.InteropServices;
#if USE_STUB
    using static Stub.Console;
#else
    using static System.Console;
#endif
    using static System.Math;
    public class Program
    {
        static void Main(string[] args)
        {
            WriteLine(Solve());
        }

        static object Solve()
        {
            var N = long.Parse(ReadLine());
            var An = ReadLine().Split().Select(long.Parse).ToArray();
            var Bn = ReadLine().Split().Select(long.Parse).ToArray();
            long count = 0;
            for (int i = 0; i < N; i++)
            {
                var b = Bn[i];
                var a = An[i];
                if (An[i] < b)
                {
                    var ba = b - a;
                    count += a + Min(An[i + 1], ba);
                    An[i + 1] = Max(0, An[i + 1] - ba);
                }
                else
                {
                    count += b;
                }
            }

            return count;
        }
    }
}


Measured memory_bytes: 39860
w = gets.to_i
n = gets.to_i
arr = (1..w).to_a

ARGF.each_line do |line|
  a, b = line.split(",").map(&:to_i)
  arr[a - 1], arr[b - 1] = arr[b - 1], arr[a - 1]
end
puts arr

Measured memory_bytes: 8488
#include<bits/stdc++.h>
using namespace std;
vector<char>ans;
void solve()
{
 long long N;
  cin>>N;
  ans.clear();
  string ref="zabcdefghijklmnopqrstuvwxy";
  while(N)
  { 
    int k=N%26;
    ans.push_back(ref[k]);
    if(k==0)
      N=(N/26)-1;
    else
      N=N/26;
    
  }
  for(int i=ans.size()-1;i>=0;i--)
  {
    cout<<ans[i];
  }
  
  
  
}

int main()
{
solve();
}

Measured memory_bytes: 3628
using System;
using System.Collections.Generic;
using System.Linq;

namespace test
{
    class MainClass
    {
        public static void Main(string[] args)
        {

            //問題158

            string s = Console.ReadLine();

            for (int i = 1; i < s.Length; i++)
            {
                if (s[0] != s[i])
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }

            Console.WriteLine("No");

        }

    }





    
}


Measured memory_bytes: 25684
H,W=map(int,input().split())
s=[list(input()) for _ in range(H)]
cnt=0
for i in range(H):
    for j in range(W):
        if s[i][j]=='#':
            l=[[i-1,j],[i+1,j],[i,j-1],[i,j+1]]
            OK=0
            for v in l:
                if H>v[0]>=0 and W>v[1]>=0:
                    if s[v[0]][v[1]]=='#':
                        OK=1
            if OK==0:
                print('No')
                exit()
print('Yes')


Measured memory_bytes: 3064