akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
 
#define ll                 long long
#define ull                unsigned long long
#define pii                pair<int, int>
#define pll                pair<ll, ll>
#define mp                 make_pair
#define ff                 first
#define ss                 second
#define sz(x)              (int) x.size()
#define all(v)             v.begin(), v.end()

template <typename T> inline void smin(T &a, T b) {a = a < b ? a : b;}
template <typename T> inline void smax(T &a, T b) {a = a > b ? a : b;}
 
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << ", ";
	err(++it, args...);
}
 
template <typename T> inline void Int(T &n) {
	n = 0; int f = 1; register int ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
	for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
	n = n * f;
}
 
template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l); }

const int mod = (int) 1e9 + 7;
 
inline int add(int a, int b) {a += b; return a >= mod ? a - mod : a;}
inline int sub(int a, int b) {a -= b; return a < 0 ? a + mod : a;}
inline int mul(int a, int b) {return (ll) a * b % mod;}
 
const int inf = (int) 2e9 + 5;
const ll  Inf = (ll) 2e18 + 5;
const int N   = (int) 5e5 + 5;

struct BIT {
	std::vector<int> bit;

	BIT() {
		bit.assign(N, 0);
	}

	void update(int x, int val) {
        while(x < N) {
        	bit[x] += val;
        	x += (x & -x);
        }
	}

	int sum(int x) {
		int ans = 0;
		while(x > 0) {
			ans += bit[x];
			x -= (x & -x);
		}
		return ans;
	}

	int query(int l, int r) {
        return sum(r) - sum(l - 1);
	}
};

int solve() {
	int n , q;
   string s; cin >> n >> s;
    Int(q);
   BIT dp[26];
   for(int i = 0; i < n; i++) {
      dp[s[i] - 'a'].update(i + 1, 1);
   }
   while(q--) {
   	int ck; cin >> ck;
   	if(ck == 1) {
   		int l; char c; cin >> l >> c;

   		dp[s[l - 1] - 'a'].update(l, -1);
   		s[l - 1] = c;
   		dp[s[l - 1] - 'a'].update(l, 1);
   	}
   	else {
   		int l, r; cin >> l >> r;
   		int ans = 0;
   		for(int i = 0; i < 26; i++) {
   			if(dp[i].query(l, r) > 0) ans++;
   		}
   		printf("%d\n", ans);
   	}
   }
	return 0;
}
 
int main() {
	//ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int test = 1, tc = 0;
	//Int(test);
	//cin >> test;
	while (test--) {
		//printf("Case %d: ", ++tc);
		solve();
	}
	return 0;
}


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



int main() {
	string a,b,c;
	cin >> a >> b >> c;
	char a1 = a.at(0)-0x20;
	char b1 = b.at(0)-0x20;
	char c1 = c.at(0)-0x20;
	cout << a1 << b1 << c1 << endl;
}


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

using namespace std;

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

  bool is_good = true;
  for (int i = 0; i < s.size(); i++) {
    if (i % 2 == 0) {
      if (s[i] == 'L') {
        is_good = false;
        break;
      }
    } else {
      if (s[i] == 'R') {
        is_good = false;
        break;
      }
    }
  }
  if (is_good)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ld long double

/* 幾何ライブラリ */
// 2次元座標, 2次元ベクトル
using pos = pair<ld, ld>;

// 加算
pos add(pos p1, pos p2) {
	return { p1.first + p2.first, p1.second + p2.second };
}
// 減算
pos sub(pos p1, pos p2) {
	return { p1.first - p2.first, p1.second - p2.second };
}
// 内積
ld inner_product(pos p1, pos p2) {
	return p1.first * p2.first + p1.second * p2.second;
}
// 定数倍
pos mul(ld c, pos p) {
	return { c * p.first, c * p.second };
}

// ノルムの2乗
ld norm2(pos p) {
	return p.first * p.first + p.second * p.second;
}
// ノルム
ld norm(pos p) {
	return sqrt(norm2(p));
}

// 射影
// pをp1, p2を通る直線に射影する
pos projection(pos p1, pos p2, pos p) {
	pos q = sub(p2, p1);
	pos tmp = mul(inner_product(q, sub(p, p1)) / norm2(q), q);
	return add(p1, tmp);
}

int main() {
	cout << setprecision(15);
	pos p1, p2;
	cin >> p1.first >> p1.second >> p2.first >> p2.second;
	int q; cin >> q;
	while (q--) {
		pos p; cin >> p.first >> p.second;
		pos res = projection(p1, p2, p);
		cout << res.first << " " << res.second << endl;
	}
	return 0;
}


Measured memory_bytes: 3300
#include<stdio.h>
int main()
{
    int C[10]={0};
    for(int i=1;i<=9;i++)
        scanf("%d",&C[i]);
    if((C[1]-C[4]==C[2]-C[5]&&C[1]-C[4]==C[3]-C[6])&&(C[4]-C[7]==C[5]-C[8]&&C[4]-C[7]==C[6]-C[9])&&(C[1]-C[7]==C[2]-C[8]&&C[1]-C[7]==C[3]-C[9])&&
       (C[1]-C[2]==C[4]-C[5]&&C[1]-C[2]==C[7]-C[8])&&(C[1]-C[3]==C[4]-C[6]&&C[1]-C[3]==C[7]-C[9])&&(C[2]-C[3]==C[5]-C[6]&&C[2]-C[3]==C[8]-C[9]))
        printf("Yes\n");
    else printf("No\n");
    return 0;
}

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

#define in freopen("input.txt", "r", stdin);
#define out freopen("output.txt", "w", stdout);
#define clr(arr, key) memset(arr, key, sizeof arr)
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define infinity (1 << 28)
#define LL long long
#define PI acos(-1)
#define gcd(a, b) __gcd(a, b)
#define CF ios_base::sync_with_stdio(0);cin.tie(0);
#define lcm(a, b) ((a)*((b)/gcd(a,b)))
#define all(v) v.begin(), v.end()
#define no_of_ones __builtin_popcount // __builtin_popcountll for LL
#define SZ(v) (int)(v.size())
#define eps 1e-7

//int col[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//int row[8] = {1, 1, 0, -1, -1, -1, 0, 1};
//int col[4] = {1, 0, -1, 0};
//int row[4] = {0, 1, 0, -1};
//int months[13] = {0, ,31,28,31,30,31,30,31,31,30,31,30,31};

using namespace std;

struct point{int x, y; point () {} point(int a, int b) {x = a, y = b;}};
template <class T> T sqr(T a){return a * a;}
template <class T> T power(T n, T p) { T res = 1; for(int i = 0; i < p; i++) res *= n; return res;}
template <class T> double getdist(T a, T b){return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));}    // distance between a and b
template <class T> T extract(string s, T ret) {stringstream ss(s); ss >> ret; return ret;}
template <class T> string tostring(T n) {stringstream ss; ss << n; return ss.str();}
//LL bigmod(LL B,LL P,LL M){LL R=1; while(P>0)  {if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return R;}
struct fast{fast(){ios_base::sync_with_stdio(0);cin.tie(0);}}cincout;

#define MAX 200010
/***********************************THE GRASS IS ALWAYS GREENER ON THE OTHER SIDE***********************************/

int arr[MAX];

int main()
{
    // in;
    LL res = 0;
    int n;
    cin >> n;
    map <LL,LL> mpp;
    for(int i = 0; i < n; i++){
        cin >> arr[i];
        if(arr[i] > n)
            continue;
        res += mpp[i-arr[i]];
        mpp[arr[i]+i]++;
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 21328
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define IOS cin.tie(0),ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline ostream& operator << (ostream& out, const vector<T>& v) {
	if (v.empty())return out;
	constexpr bool is_vector_v = is_vector<T>::value;
	if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
	else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
	return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }


int main() {
	IOS;
	int n;
	cin >> n;
	vector<int> a(n);
	REP(i, n) {
		cin >> a[i];
	}
	vector<vector<int>> d(n, vector<int>(20, 0));
	REP(i, n) {
		int temp = a[i];
		REP(j, 20) {
			d[i][j] = temp % 2;
			temp /= 2;
		}
	}
	vector<vector<int>> next(n, vector<int>(20, 0));
	REP(j, 20) {
		int t1 = n, t2 = n;
		RREP(i, n) {
			if (d[i][j] == 1) {
				t2 = t1;
				t1 = i;
			}
			next[i][j] = t2;
		}
	}
	vector<int> m(n,INT_MAX);
	REP(i, n) {
		REP(j, 20) {
			chmin(m[i], next[i][j]);
		}
	}
	REP(i, n) {
		m[i] -= i;
	}
	ll res = 0;
	REP(i, n) {
		res += m[i];
	}
	put(res);
	return 0;
}


Measured memory_bytes: 48768
from math import sqrt
def judge(num):
    if num < 2:
        return False
    elif num == 2:
        return True
    elif num % 2 == 0:
        return False
    else:
        for i in range(3,int(sqrt(num))+1,2):
            if num % i == 0:
                return False
        return True
s = int(input()) 
while(1):
    if judge(s):
        print(s)
        break
    else:
        s += 1

Measured memory_bytes: 3060
#include<iostream>
#define llt long long 
using namespace std;
	
void sum(llt n){


    llt divi[n+1]={0};
    llt cnt=0;

        for(llt i=1;i<=n;i++){
        for(llt j=i;j<=n;j=j+i){
           
            divi[j]++;
        }
    }


    
        
        llt ans=0;
        for(llt i=1;i<=n;i++){
            ans+=i*divi[i];
        }
            cout<<ans<<endl;

}	



int main(){
	llt n;
cin>>n;
sum(n);

	return 0;
}

Measured memory_bytes: 81756
// C - Rally
#include <bits/stdc++.h>

using namespace std;

int main(int argc, char *argv[])
{
	int n;
	cin >> n;
	vector<long long> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	sort(a.begin(), a.end());
	long long ans = 1e18;
	for (long long i = a[0]; i <= a.back(); i++) {
		long long sum = 0;
		for (int j = 0; j < a.size(); j++)
			sum += (a[j] - i) * (a[j] - i);
		ans = min(ans, sum);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
# -*- coding:utf-8 -*-
### スペース区切りの３つの数値を入力。
### 入力された数値が小さい順に並んでいたらYes、違ければ No を出力する。
str_in = raw_input()
int_in = map(int, str_in.split())

if int_in[0] < int_in[1] :
	if int_in[1] < int_in[2] :
		str_out = 'Yes'
	else:
		str_out = 'No'
else:
	str_out = 'No'

print(str_out)



Measured memory_bytes: 4632
#include <iostream>

#include <map>
#include <unordered_map>
#include <algorithm>
#include <vector>

using namespace std;
//const char a[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};



void solver() {
    string s;
    cin>>s;
    unordered_map<char,int> ele;
    for(int i=0;i<s.size();i++)
    {
        ele[s[i]]++;
    }
    bool my=true;
    for(auto i:ele)
    {
        if(i.second%2==1)
        {
            my=false;
        }
    }
    if(my)
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
























}


int main() {
    int n=1;
    //cin>>n;
    while(n--)
    {
        solver();
    }
}


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

using namespace std;

using ll = long long;
constexpr ll MOD = 1e9 + 7;
constexpr ll INF = 1e18;

int main() {
    ll n, K, T;
    cin >> K >> T;
    vector<ll> a(T);
    vector<ll> cnt(T);
    ll S = 0;
    for(auto &x : a) {
        cin >> x;
    }
    ll M = -1;
    for(ll i = 0; i < T; i++) {
        M = max(M, a[i]);
    }
    if(K-M>=M-1){
        cout << 0 << endl;
    }else{
        cout << M-1-(K-M) << endl;
    }
}

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

namespace ABC142
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] nk = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] h = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int ans = 0;
            for (int i = 0; i < nk[0]; i++)
            {
                if (h[i] >= nk[1]) { ans++; }
            }
            Console.WriteLine(ans);
        }
    }
}


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


#define M 1000000007
#define pb push_back
#define mp make_pair
#define s second
#define f first
#define mod 998244353
#define sz(v) (int)(v).size()

#define pii pair<int, int>
#define vi vector<int>
#define ll long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(0)

ll add(ll a,ll b)
{
	a%=M;
	b%=M;
	ll p = (a+b)%M;
	return (p+M)%M;
}

ll mul(ll a,ll b)
{
	a%=M;
	b%=M;
	ll p = (a*b)%M;
	return (p+M)%M;
}


int main()
{
	fastio;
	ll val,i,j,n,a[100];
	cin>>n;
	for(i=0;i<n;i++)
		cin>>a[i];
	val=1000;
	for(i=0;i<n;)
	{
		ll tmp = val%a[i];
		ll st=val/a[i];
		val=tmp;
		ll ma=a[i];
		j=i+1;
		while((j<n)&&(a[j]>a[j-1]))
		{
			ma=max(ma,a[j]);
			j++;
		}
		val += ma*st;
		i=j;
	}
	cout<<val<<endl;
    return 0;
}





Measured memory_bytes: 3652
import java.util.*;
import java.util.Collections;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt();
    int A = sc.nextInt();
    sc.close();
    if (X < A) {
      System.out.println(0);
    } else {
      System.out.println(10);
    }
  }
}


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

using ll=long long;
const ll INF = 1e16;
template<class T> inline bool chmax(T &a, T b) {if(a < b) {a = b;return true;}return false;}

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

int main(){
    ll N,M,L,Q;
    ll A,B,C;
    cin >> N >> M >> L;
    vector<vector<ll>> MAP(N,vector<ll>(N,INF));
    vector<vector<ll>> ANS(N,vector<ll>(N,INF));

    for(int i=0;i<M;i++){
        cin >> A >> B >> C;
        A--;B--;
        MAP[A][B] = C;
        MAP[B][A] = C;
        // ANS[A][B] = ANS[B][A] = C;
    }
    cin >> Q;
    vector<ll> s(Q);
    vector<ll> t(Q);
    for(int i=0;i<Q;i++){
        cin >> s[i] >> t[i];
        s[i]--;t[i]--;
    }

    for(int i=0;i<N;i++){
        ANS[i][i] = 0;
        MAP[i][i] = 0;
    }

    for(int k=0;k<N;k++){
        for(int i=0;i<N;i++){
            for(int j=0;j<N;j++){
                if(MAP[i][j]>MAP[i][k]+MAP[k][j])MAP[i][j]=MAP[i][k]+MAP[k][j];
            }
        }
    }

    
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(i==j)continue;
            if(MAP[i][j]<=L)ANS[i][j]=1LL;
            // else ANS[i][j] = MAP[i][j];
        }
    }
    // w_f(ANS,N);
    for(int k=0;k<N;k++){
        for(int i=0;i<N;i++){
            for(int j=0;j<N;j++){
                if(ANS[i][j]>ANS[i][k]+ANS[k][j]) ANS[i][j] = ANS[i][k]+ANS[k][j];
            }
        }
    }

    for(int i=0;i<Q;i++){
        if(ANS[s[i]][t[i]]<INF)cout << ANS[s[i]][t[i]]-1 << endl;
        else cout << -1 << endl;
    }
}


Measured memory_bytes: 3328
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>

using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int N = 50 + 5;


int main() {
    int n, m;
    cin >> n >> m;
    if (n >= m)
        for (int i = 0; i < n; i++)
            cout << m;
    else
        for (int i = 0; i < m; i++)
            cout << n;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,a,b) for(int(i)=(a);(i)<(b);++(i))
#define RREP(i,a,b) for(int(i)=(a)-1;(i)>=(b);--(i))
#define ALL(x) (x).begin(),(x).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
using namespace std;
typedef long long ll;
const int MAX_N = (int)1e5 + 10;
const ll INF = 1e18;

int N;
vector<int> A;
// dp(i+1,j): A[0]...A[i]を確定し，
// j=1ならA[i+1]の符号を反転させた(A[i]をひっくり返した)場合の
// A[0]...A[i]の和の最大値
ll dp[MAX_N][2];

int main()
{
  cin >> N;
  A.resize(N);
  REP(i,0,N) cin >> A[i];

  dp[0][0] = 0;
  dp[0][1] = -INF;
  REP(i,0,N) {
    // 右: A[i]は反転しており，A[i]はひっくり返さない
    dp[i+1][0] = max(dp[i][0]+A[i], dp[i][1]-A[i]);
    // 右: A[i]は反転しており，A[i]も反転 (A[i]はもとに戻る)
    dp[i+1][1] = max(dp[i][0]-A[i], dp[i][1]+A[i]);
  }
  // A[N-1]は反転不可なので，dp[N][1]は無効
  cout << dp[N][0] << endl;

  return 0;
}


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

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

	int l, r, d, cnt = 0;
	cin >> l >> r >> d;
	for (int i = l; i <= r; ++i)
		if (i % d == 0) ++cnt;
	cout << cnt;

	return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
using vs = vector<string>;
using vb = vector<bool>;
#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 REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;
    int a;
    int ans = 0;
    REP1(i, n) {
        cin >> a;
        if (i % 2 == 1 and a % 2 == 1) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,s=0;
	cin>>n;
	if(n>=105)
	s++;
	if(n>=135)
	s++;
	if(n>=189)
	s++;
	if(n>=195)
	s++;
	if(n>=165)
	s++;
	cout<<s;
	return 0;
	
	
}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
 
void frm(int H, int W){
  for (int i = 0; i < H; i++) {
      for(int j = 0; j < W; j++) {
        if (i == 0 || i == H-1 || j == 0 || j == W - 1){
          cout << '#';
        }else{
          cout << '.';
        } 
      } 
      cout << endl;     
  }
}
 
int main(){
  int H,W;
 
  while(1){
    cin >> H >> W;
    if(H == 0 && W == 0) return 0;
     
    frm(H, W);
    cout << endl;
  }
}

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

int main(void){
    int k,n,a,b,ma=0,f;cin>>k>>n>>f;a=f;
    for(int i=1;i<n;i++){
        cin>>b;
        if(b-a>ma)ma=b-a;
        a=b;
    }
    ma=max(ma,f+k-a);
    cout<<k-ma<<endl;
    
    return 0;
}


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

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

    int s[n];
    int r = 0;
    for(int i = 0; i < n; i++) {
        char ip;
        cin >> ip;
        if(ip == 'R') {
            r++;
            s[i] = r;
        } else {
            s[i] = 0;
        }
    }

    if(r != 0) {
        int k = r - 1;
        while(k > 0 && s[k] == 0) {
            k--;
        }
        cout << r - s[k] << endl;
    } else {
        cout << 0 << endl;
    }

    return 0;
}

Measured memory_bytes: 4304
#include<cstdio>

using namespace std;

int n,m,k;

int main () {
	scanf("%d%d",&n,&m);
	for (int i=0;i<m;i++) {
		int x; scanf("%d",&x);
		k+=x;
	}
	if (k<n) {
		printf("No\n");
	}
	else {
		printf("Yes\n");
	}
	return 0;
}

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

int main(){
    
    int n,a,b;
    cin>>n;
    string str1, str2;
    
    a=0;
    b=0;
    
  for(int i=0;i<n;i++){

  cin >> str1 >> str2;
  
  if ( str1 == str2 ){
  a+=1;
  b+=1;
  }
  else if ( str1 < str2 ) b+=3;
  else if ( str1 > str2 ) a+=3;
  }
    cout<<a<<" "<<b<<endl;
    
return 0;
}


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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const llint INF = 1<<21;
// static const llint MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

int main(void) {
    int n;
    cin >> n;

    int i=1;
    while(1) {
        if(i*i>n) { 
            cout << (i-1)*(i-1) << endl;
            break;
        }
        else if(i*i==n) { 
            cout << i*i << endl;
            break;
        }
        else i++;
    }
    return 0;
}


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

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

int MOD=1e9+7;
ll INF=1e18;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};

int a[510][510];

int main(){
    int h, w; cin>>h>>w;
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            cin>>a[i][j];
        }
    }

    vector<T> ans;
    for(int i=0; i<h; i++){
        for(int j=0; j<w-1; j++){
            if(a[i][j]%2==1){
                ans.push_back(T(i+1, j+1, i+1, j+2));
                a[i][j]--;
                a[i][j+1]++;
            }
        }
    }

    for(int i=0; i<h-1; i++){
        if(a[i][w-1]%2==1){
            ans.push_back(T(i+1, w, i+2, w));
            a[i][w-1]--;
            a[i+1][w-1]++;
        }
    }

    cout << ans.size() << endl;
    for(int i=0; i<ans.size(); i++){
        int py, px, ny, nx;
        tie(py, px, ny, nx)=ans[i];
        cout << py << " " << px << " " << ny << " " << nx << endl;
    }
}

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

#define rep(i, x, n) for (int i = x; i < n; i++)
typedef long long ll;

const int INF = 1e9 + 7;

using namespace std;

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

	string s;
	cin >> s;

	int res = 0;
	int tmp = 0;
	rep (i, 0, s.size()) {
		if (s[i] == 'A' || s[i] == 'T' || s[i] == 'C' || s[i] == 'G') {
			tmp++;
		} else {
			res = max(res, tmp);
			tmp = 0;
		}
	}

	res = max(res, tmp);
	cout << res << endl;
	return 0;
}


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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define DBG(...)                \
  cerr << #__VA_ARGS__ << ": "; \
  debug(__VA_ARGS__);           \
  cerr << " (L" << __LINE__ << ")" << endl
#else
#define DBG(...)
#endif

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, n) for (auto i : (n))
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)

using namespace std;

int main() {
  int A, B;
  cin >> A >> B;
  REP(i, 1500) if (floor(i * 0.08) == A && floor(i * 0.1) == B) {
    cout << i << endl;
    return 0;
  }
  cout << "-1" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds ;
#define ll long long
#define ld long double
#define rep(i,a,b) for(ll i=a;i<b;i+=1)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define sz(a) (ll)a.size()
#define hell (ll)1000000007
#define f first
#define s second
#define sll(x) scanf("%lld",&x)
#define si(x) scanf("%d",&x)
typedef tree< ll , null_type , less<ll> , rb_tree_tag , tree_order_statistics_node_update > ordered_set ;
ll t = 1 , tt  , ttt ;
void solve()
{
    ll n , x ;
    cin >> n >> x ;
    n < x ? cout << 0 : cout << 10 ;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("tourist.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //cin>>t;
    ttt = t ;
    tt = t ;
    while(t--)
        solve() ;
    return 0 ;
}


Measured memory_bytes: 256
////////////////////////////////////////////////////////////////////
// This source code is for Visual C++ 2010 Express
////////////////////////////////////////////////////////////////////
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <stack>
#include <functional>
#include <iomanip>
#include <string>
#include <cstring>
#include <deque>
#include <math.h>
//#include "UnionFind.h"

#define	numberof(a)	(sizeof(a) / sizeof(a[0]))
#define	INF		(1000000)
#define Rep(i,n) for(int i = 0; i < (n); i++ )

using namespace std;

typedef vector< vector<int> > mat;
typedef pair<int, int> P;
typedef long long ll;
struct Point{
	ll x;
	ll y;
	Point() {};
	Point( ll xx, ll yy ) : x(xx), y(yy) {};
};

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

map<ll, ll> prime_factor(ll N)
{
	// 素因数分解
	map<ll, ll> ret;
	for( ll i = 2; i * i <= N; i++ ){
		while( N % i == 0 ){
			ret[i]++;
			N /= i;
		}
	}
	if(N != 1) ret[N] = 1;
	return ret;
}

int main()
{
	ll N = 0;
	ll ret = 0;

	cin >> N;
	vector<ll> p(N, 0);
	Rep(i, N){
		cin >> p[i];
	}
	for(ll i = 1; i < N - 1; ++i){
		if( (p[i - 1] < p[i]) && (p[i] < p[i + 1])
		||	(p[i + 1] < p[i]) && (p[i] < p[i - 1]) ){
			ret++;
		}
	}
	cout << ret << endl;

	return 0;
}





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

    using namespace std;

    #define mp make_pair
    #define pb push_back
    #define ll long long
    #define fi first
    #define se second
    #define MOD (1000000000+7)

    #define gets(a) getline(std::cin,a)
    #define all(a) a.begin(),a.end()
    #define fill(a,v) memset(a,v,sizeof(a))


    #define bitcount __buitin_popcount
    #define gcd __gcd
    #define endl "\n"

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

    const int maxn = 1e5 + 7;


    int main()  {
//       freopen("input.txt","r",stdin);

        ll n,x;
        cin >> n >> x;

        ll a[n];
        for(int i = 0 ; i < n ; ++i)
            cin >> a[i];

        ll ops = 0;
        for(int i = 0 ; i < n - 1 ; ++i){
            ll now = a[i],next = a[i+1];

            ll sum = now + next;
            if(sum > x){
                if(next >= (sum - x)){
                    next -= (sum - x);
                    ops += sum - x;
                }
                else {
                    ops += next;
                    now -= (sum - x - next);
                    ops += (sum - x - next);
                    next = 0;
                }
                a[i+1] = next;
                a[i] = now;
            }

        }
       // for(int i = 0 ; i < n ; ++i) cout << a[i] << " ";
        cout << ops;

}


            
            
            

Measured memory_bytes: 1152
#include<cstdio>
#include<iostream>
using namespace std;
int n,r,a[200005],s[25];
long long ans;
void insert(int x){
	for(int i=1;i<=21;i++) s[i]+=x&1,x>>=1;
}
void del(int x){
	for(int i=1;i<=21;i++) s[i]-=x&1,x>>=1;
}
bool check(int x){
	for(int i=1;i<=21;i++){
		if(s[i]==1 && (x&1)==1) return 0;
		x>>=1;
	}
	return 1;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	r=1;
	insert(a[1]);
	for(int i=1;i<=n;i++){
		while(r<n && check(a[r+1])) insert(a[++r]);
		ans+=r-i+1;
		del(a[i]);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ll X,Y,Z,K;
    cin >> X >> Y >> Z >> K;
    vector<ll> candle1(X);
    vector<ll> candle2(Y);
    vector<ll> candle3(Z);
    rep(i,X){
        cin >> candle1[i];
    }
    rep(i,Y){
        cin >> candle2[i];
    }
    rep(i,Z){
        cin >> candle3[i];
    }
    sort(all(candle1));
    sort(all(candle2));
    sort(all(candle3));
    vector<ll> vec_first(0);
    vector<ll> vec_second(0);
    rep(i,X){
        rep(j,Y){
            vec_first.push_back(candle1[i] + candle2[j]);
        }
    }
    sort(all(vec_first));
    ll k = 3000;
    ll len = vec_first.size();
    for (ll i = 1; i <= min(k,len); i++){
        rep(j,Z){
            vec_second.push_back(vec_first[vec_first.size() - i] + candle3[j]);
        }
    }
    sort(all(vec_second));
    rep(i,K){
        cout << vec_second[vec_second.size() - i - 1] << endl;
    }
}



Measured memory_bytes: 44104
w = input()

w_dict = dict()
for i in range(len(w)):
    if w[i] in w_dict:
        w_dict[w[i]] += 1
    else:
        w_dict[w[i]] = 1
        
for v in w_dict.values():
    if v % 2 != 0:
        print("No")
        exit()
        
print("Yes")

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

using namespace std;

int arr[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main() {
	int kk;
	cin >> kk;
	kk--;
	cout << arr[kk] << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vl vector<LL>
#define vii vector<vi>
#define vll vector<vl>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

int main(){
	LL n,x,m;
    cin>>n>>x>>m;
    LL t=m,s=0;
    vl a(m,0),b(m+2,0);
    a[x]=1;b[1]=x;
    FOR(i,1,n){
        x=(x*x)%m;
        //cerr<<i<<" "<<x<<endl;
        if(a[x]!=0){
            t=i-a[x]+1;
            s=a[x]-1;
            break;
        }
        a[x]=i+1;
        b[i+1]=x;
    }
    //cerr<<s<<" "<<t<<endl;
    LL ans=0;
    FOR(i,0,s){
        ans+=b[i+1];
    }
    b[s]=0;
    FOR(i,s,s+t){
        b[i+1]+=b[i];
    }
    //cerr<<b[s+t]<<endl;
    n-=s;
    ans+=n/t*b[s+t];
    ans+=b[s+(n%t)];
    cout<<ans<<endl;
    
}


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

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<vector<int>> arr(n, vector<int>(3));
    for(int i=0;i<n;i++){cin >> arr[i][0] >> arr[i][1] >> arr[i][2];}
    vector<int> dp(3);
    dp[0] = arr[0][0]; dp[1] = arr[0][1]; dp[2] = arr[0][2];
    for(int i=1;i<n;i++){
        int first = dp[0], second = dp[1], third = dp[2];
        dp[0] = max(second+arr[i][0], third+arr[i][0]);
        dp[1] = max(first+arr[i][1], third+arr[i][1]);
        dp[2] = max(first+arr[i][2], second+arr[i][2]);
    }
    cout << max(dp[0], max(dp[1], dp[2])) << endl;
    return 0;
}

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

int main()
{
    const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286l;
    int a, b, h, m;

    scanf("%d %d %d %d", &a, &b, &h, &m);
    double deg = fabs(30.0l * h - 5.5l * m);

    double power = a * a + b * b - 2.0l * a * b * cos(pi * deg / 180.0l);
    // printf("deg: %.17lf\n", deg);
    printf("%.17lf", sqrt(power));

    return 0;
}

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

using namespace std;

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

    string s;
    cin >> s;

    int n = s.size();
    vector<int> ans(n , 0) , left(n , 0) , right(n , n);

    for (int i = 1 ;i < n ;i++) {
        if (s[i] == 'L') {
            if (s[i - 1] == 'L')
                left[i] = left[i - 1];
            else
                left[i] = i;
        }
    }

    for (int i = n - 2 ;i >= 0 ;i--) {
        if (s[i] == 'R') {
            if (s[i + 1] == 'R')
                right[i] = right[i + 1];
            else
                right[i] = i;
        }
    }


    for (int i = 0 ;i < n ;i++) {
        if (s[i] == 'R') {
            if (right[i] == n - 1) {
                ans[right[i]]++;
                continue;
            }
            int c = right[i] - i;
            if (c&1)
                ans[right[i] + 1]++;
            else
                ans[right[i]]++;
        } else {
            if (left[i] == 0) {
                ans[left[i]]++;
                continue;
            }
            int c = i - left[i];
            if (c&1)
                ans[left[i] - 1]++;
            else
                ans[left[i]]++;
        }
    }

    for (int c : ans)
        cout << c << ' ';
}


Measured memory_bytes: 4516
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll l,r,d,cnt=0;
    cin>>l>>r>>d;
    for(ll i=1;i*d<=100;i++)
    {
        if(i*d<=r&&i*d>=l)
            cnt++;
    }
    cout<<cnt;

}


Measured memory_bytes: 3632
n, a, b = map(int, input().split())

t = n//(a+b)
c=0

if t == 0 and n < a:
    c += n
    print(c)
elif t == 0 and n >= a:
    c += a
    print(c)
elif t > 0:
    c += t * a
    r = n%(a+b)
    if r == 0:
        print(c)
    elif r < a:
        c += r 
        print(c)
    elif r > a:
        c += a
        print(c)
    

Measured memory_bytes: 3064
#include <stdio.h>
#include<algorithm>
#include<vector>
#include <iostream>
using namespace std;
int n,a[1005];
int main(){
  while(1){
    cin >> n; if(n==0) return 0;
    for(int i=1;i<=n;i++) cin >> a[i];
    sort(a+1,a+n+1);
    int res = 10000000;
    for(int i=2;i<=n;i++) res = min(res,a[i]-a[i-1]);
    cout << res << endl;
  }
}

Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for (int i = (a); i < (b); i++)

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    // cout << fixed << setprecision(10);
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 0;
    rep(i, 0, 100) {
        char a = '0' + (i / 10), b = '0' + (i % 10);
        vector<bool> v(10, false);
        int st = 0;
        for (st = 0; st < n; st++) {
            if (s[st] == a) {
                st++;
                break;
            }
        }
        for (; st < n; st++) {
            if (s[st] == b)
                break;
        }
        for (int j = st + 1; j < n; j++) {
            v[s[j] - '0'] = true;
            // cout << a << b << s[j] << endl;
        }
        rep(j, 0, 10) ans += v[j];
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  int odd = 0;
  for(int i=0;i<N;i++){
    cin >> A.at(i);
    odd += A.at(i) % 2;
  }
  
  if(odd % 2 == 0)  cout << "YES" << endl;
  else  cout << "NO" << endl;
}

Measured memory_bytes: 640
#include <strings.h>
#include <stdio.h>

int main(void) {                                                                
    int n;                                                                      
    int i, j, data;                                                             
    int matrix[11][11] = {};                                                    
                                                                                
    while (scanf("%d", &n), n) {                                                
        bzero(matrix, 11*11*sizeof(int));                                       
        for (i = 0; i < n; i++) {                                               
            for (j = 0; j < n; j++) {                                           
                scanf("%d", &data);                                             
                matrix[i][j] = data;                                            
                matrix[i][n] += data;                                           
            }                                                                   
        }                                                                       
                                                                                
        for (i = 0; i < n + 1; i++) {                                           
            for (j = 0; j < n + 1; j++) {                                       
                printf("%5d", matrix[i][j]);                                    
                matrix[n][j] += matrix[i][j];                                   
            }                                                                   
            printf("\n");                                                       
        }                                                                       
    }                                                                           
                                                                                
    return 0;                                                                   
}

Measured memory_bytes: 616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(int i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

ll h, w, ch, cw, dh, dw, dst[1010][1010];
string s[1010];

struct dijkstra{
    vector<long long> min_dst;
    vector<vector<pair<long long, long long>>> G;

    dijkstra(int n){
        min_dst.resize(n);
        G.resize(n);
    }

    void append(int u, int v, long long cost){G[u].push_back(make_pair(v, cost));}
    
    void run(int s){
        priority_queue<pair<long long, long long>, vector<pair<long long, long long>>, greater<pair<long long, long long>>> que;
        fill(min_dst.begin(), min_dst.end(), -1);
        min_dst[s] = 0;
        que.push(make_pair(0, s));
        
        while(!que.empty()){
            auto p = que.top(); que.pop();
            int at = p.second;
            if(min_dst[at] < p.first){continue;}
            for(int i = 0; i < G[at].size(); i++){
                int to = G[at][i].first;
                long long cost = G[at][i].second;
                if(min_dst[to] == -1 || min_dst[at] + cost < min_dst[to]){
                    min_dst[to] = min_dst[at] + cost;
                    que.push(make_pair(min_dst[to], to));
                }
            }
        }	
    }
    
    long long get(int at){return min_dst[at];}
};

ll encode(ll x, ll y){
    return x * w + y;
}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    
    cin >> h >> w >> ch >> cw >> dh >> dw;
    zep(i, 0, h)cin >> s[i];
    ch--; cw--; dh--; dw--;

    dijkstra d(h * w);

    ll dx[4] = {-1, 1, 0, 0};
    ll dy[4] = {0, 0, -1, 1};
    zep(i, 0, h){
        zep(j, 0, w){
            zep(k, 0, 4){
                ll nx = i + dx[k], ny = j + dy[k];

                if(0 <= nx && nx < h && 0 <= ny && ny < w){
                    if(s[i][j] == '.' && s[nx][ny] == '.'){
                        d.append(encode(i, j), encode(nx, ny), 0);
                    }
                }
            }

            rep(k, -2, 2){
                rep(l, -2, 2){
                    ll nx = i + k, ny = j + l;

                    if(!(k == 0 && l == 0) && 0 <= nx && nx < h && 0 <= ny && ny < w){
                        if(s[i][j] == '.' && s[nx][ny] == '.'){
                            d.append(encode(i, j), encode(nx, ny), 1);
                        }
                    }
                }
            }
        }
    }

    d.run(encode(ch, cw));
    print(d.get(encode(dh, dw)))

    return 0;
}

Measured memory_bytes: 191516
/*
 Abu Jafor Mohammad Saleh
 ios_base :: sync_with_stdio(false);
 cin.tie(NULL);
 
 */

#include<cstdio>
#include<iomanip>
#include<sstream>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<set>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<iostream>
#include<fstream>
#include<numeric>
#include<string>
#include<vector>
#include<cstring>
#include<map>
#include<iterator>
#include<limits>
#include <algorithm>
#include <unordered_map>
#include<fstream>
#define f first
#define s second
#define MOD 1000003

#define INF (int)1e9
#define PI 3.1415926535897932384626433832795
#define BOUNDARY(i, j) ((i >= 0 && i < rows) && (j >= 0 && j < coloums))

//#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
const int maxn = 100001;
using namespace std;
int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
int rows,coloums;
long long  gcd(long long  a, long long b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

int main()
{
    fast;
    double w,h,x,y;
    cin>>w>>h>>x>>y;
    double total = w*h;
    
    total = total/2;
    
    bool ans = false;
    
    if( x*2 == w && y*2 == h)
        ans = true;
    
    cout<<total<<' '<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static int N;

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    N = sc.nextInt();
    int[] num = new int[101];
    for (int i = 2; i <= N; i++) {
      int tmp = i;
      for (int j = 2; j * j <= tmp; j++) {
        while (tmp % j == 0) {
          num[j]++;
          tmp /= j;
        }
      }
      if (tmp != 1) {
        num[tmp]++;
      }
    }
    int ans = 0;
    // p^74
    ans += count(74, num);
    // p^24 * q^2
    ans += count(24, num) * (count(2, num) - 1);
    // p^14 * q^4
    ans += count(14, num) * (count(4, num) - 1);
    // p^4 * q^4 * r^2
    ans += count(4, num) * (count(4, num) - 1) * (count(2, num) - 2) / 2;
    System.out.println(ans);
  }

  public static int count(int n, int[] a) {
    int count = 0;
    for (int i = 2; i <= N; i++) {
      if (a[i] >= n) {
        count++;
      }
    }
    return count;
  }
}

Measured memory_bytes: 22996
#include <iostream>
#include <stack>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  int N;
  cin >> N;
  vector<vector<pair<int, int>>> G(N + 1);
  rep(i, N - 1) {
    int u, v, w;
    cin >> u >> v >> w;
    G[u].emplace_back(v, w);
    G[v].emplace_back(u, w);
  }

  vector<int> color(N + 1, -1);
  stack<pair<int, int64_t>> dfs;
  dfs.emplace(1, 0);
  color[1] = 0;
  while (!dfs.empty()) {
    int v;
    int64_t dist;
    tie(v, dist) = dfs.top();
    dfs.pop();
    if (dist % 2 == 0)
      color[v] = 0;
    else
      color[v] = 1;

    for (auto& nv : G[v]) {
      if (color[nv.first] != -1) continue;
      dfs.emplace(nv.first, dist + nv.second);
    }
  }

  for (int i = 1; i <= N; ++i) {
    cout << color[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 6784
import os
import io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline


n, q = list(map(int, input().split()))
count = (n - 2) ** 2
c = [n] * (n + 1)
r = [n] * (n + 1)
mc = n
mr = n
for _ in range(q):
    m,q = list(map(int, input().split()))
    if m == 1:
        if q <= mc:
            count -= mr -2
            for p in range(q+1, mc):
                c[p] = mr
            c[q] = 0
            mc = q
        else:
            count -= c[q] - 2
    else:
        if q <= mr:
            count -= mc -2
            for p in range(q+1, mr):
                r[p] = mc
            r[q] = 0
            mr = q
        else:
            count -= r[q] - 2
print(count)


Measured memory_bytes: 83368
#include "bits/stdc++.h"
using namespace std;

int main(){
    int x , y , Ans = 0;
    scanf( "%d%d" , &x , &y );

    if( x == 1 ) Ans += 300000;
    else if( x == 2 ) Ans += 200000;
    else if( x == 3 ) Ans += 100000;

    if( y == 1 ) Ans += 300000;
    else if( y == 2 ) Ans += 200000;
    else if( y == 3 ) Ans += 100000;

    if( x == 1 && y == 1 ) Ans += 400000;
    printf( "%d\n" , Ans );
    return 0;
}

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

using namespace std;

template<class T>
bool Binary_Search(vector<T> V, T x, int left, int right){
  //整列すれば二分探索が使える。
  int mid;
  while(left < right){
    mid = (left + right)/2;
    //printf("left=%d, right=%d, mid=%d\n",left,right,mid);
    if(V[mid] < x){
      left = mid+1;
    }
    else if(V[mid] > x){
      right = mid;
    }else {
      //一致した時
      return true;
    }
  }
  return false;
}

int main(){
  int n,q,x,i;
  vector<int> S;
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    scanf("%d",&x);
    S.push_back(x);
  }
  scanf("%d",&q);
  int c = 0;
  for(i = 0; i < q; i++){
    scanf("%d",&x);
    if(Binary_Search<int>(S,x,0,n)) c++;
  }
  printf("%d\n", c);
  return 0;
}



Measured memory_bytes: 3764
#include<cstdio>
#include<vector>
const int inf = 10000007;
std::vector<int>g[1005];
int f[1005][2][5005];
int offer[1005];
int x[1005];

int min(int a,int b){ return a>b?b:a; }

void dp(int u){
    int cur = 0;
    for(int i = 1; i <= x[u]; i++) f[u][cur][i] = inf;
    f[u][cur][0] = 0;
    //int ok = 1;
    for(int v: g[u]){
        dp(v);
        int a = x[v], b = offer[v];
        int last = cur; cur = !cur;
        for(int i = 0; i <= x[u]; i++){
            f[u][cur][i] = inf;
            int before = i-a;
            if(before>=0) f[u][cur][i] = min(f[u][cur][i],f[u][last][before]+b);
            before = i-b;
            if(before>=0) f[u][cur][i] = min(f[u][cur][i],f[u][last][before]+a);
        }
    }
    offer[u] = inf;
    for(int i = 0; i <= x[u]; i++) offer[u] = min(offer[u],f[u][cur][i]);
}

int main(){
    int n;
    scanf("%d",&n);
    for(int i = 2; i <= n; i++){
        int p;
        scanf("%d",&p);
        g[p].push_back(i);
    }
    for(int i = 1; i <= n; i++) scanf("%d",&x[i]);
    dp(1);
    if(offer[1]<inf) printf("POSSIBLE\n");
    else printf("IMPOSSIBLE\n");
    return 0;
}


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


int main()
{
    int x;
    set<int> s;

    for(int i=1; i<=9; i++) 
        for(int j=1; j<=9; j++) 
            s.insert(i*j);

    cin >> x;


    printf("%s\n", (s.count(x))?"Yes":"No");
}

Measured memory_bytes: 256