akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
typedef long long ll;
int main(){
    int n,k; cin >> n >> k;
    vector<int> h(n);
    rep(i,n) cin >> h[i];
    
    int ans = 0;
    rep(i,n){
        if(h[i] >= k) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 640
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using Tup = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define prt(v) cout<<(v)<<"\n";
#define fl cout<<flush;
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
#define endl '\n'
template <typename T> inline bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> inline bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld pi=3.141592653589793238;

signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll x;
    cin >> x;
    ll y;
    cin >> y;
    if(2*x<=y&&y<=4*x&&y%2==0){
        prt("Yes")
    }
    else prt("No")fl

    return 0;
}


Measured memory_bytes: 3652
A, B, C = map(int, input().split())
K = int(input())
ans = 'No'
while(K > 0 and B <= A):
    B *= 2
    K -= 1

while(K > 0 and C <= B):
    C *= 2
    K -= 1

if B > A and C > B:
    ans = 'Yes'
    
print(ans)

Measured memory_bytes: 9184
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define LOWER(a,x) lower_bound(ALL(a), x) - a.begin() - 1;
#define COUNT(a,x)  upper_bound(ALL(a), x) - lower_bound(ALL(a), x);
#define MCOUNT(a,x,y) upper_bound(ALL(a), y) - lower_bound(ALL(a), x);
#define scan(x) scanf("%lld",&x);
#define inf 5555555555555555555
#define mod 1000000007
#define pi 3.14159265358979323846
#define pb push_back
#define F first
#define S second
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef map<ll, ll> MAP;
typedef set<ll> SET;
ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, tmp = 0, ma = 0, mi = 0;
string s;
bool flag, ok;
ll dx[4] = { 1,-1,0,0 }, dy[4] = { 0,0,1,-1 };
ll ddx[9] = { 1,-1,0,0,1,1,-1,-1,0 }, ddy[9] = { 0,0,1,-1,1,-1,1,-1,0 };
#pragma endregion
#define MAX 111111

struct UnionFind {
  vll rank, par, data;

  void set(ll n) {
	rank.resize(n + 1, 0);
	par.resize(n + 1, 0);
	data.resize(n + 1, 1);
	REP(i, n + 1) par[i] = i;
  }

  ll root(ll x) {
	if (x != par[x]) par[x] = root(par[x]);
	return par[x];
  }

  ll size(ll x) {
	return data[root(x)];
  }

  void unite(ll a, ll b) {
	ll x = root(a);
	ll y = root(b);
	if (x == y) return;
	if (rank[x] > rank[y]) {
	  par[y] = x;
	  data[x] += data[y];
	}
	else {
	  par[x] = y;
	  data[y] += data[x];
	  if (rank[x] == rank[y]) rank[y]++;
	}
  }

  bool same(ll a, ll b) {
	return root(a) == root(b);
  }
};

struct edge {
  ll cost;
  pll node;
  edge(ll c, pll n) : cost(c), node(n) {}
  bool operator>(const edge &e) const {
	return cost > e.cost;
  }
};

priority_queue<edge, vector<edge>, greater<edge>> pq;

int main(void) {
  ll a, b;
  UnionFind u;
  vector<pll> x, y;
  edge e = { 0,pll(0,0) };
  cin >> n;
  u.set(n);
  FOR(i, 0, n) {
	cin >> a >> b;
	x.pb(pll(a, i));
	y.pb(pll(b, i));
  }
  sort(ALL(x));
  sort(ALL(y));

  FOR(i, 0, n - 1) {
	pq.push(edge(x[i + 1].F - x[i].F, pll(x[i].S, x[i + 1].S)));
	pq.push(edge(y[i + 1].F - y[i].F, pll(y[i].S, y[i + 1].S)));
  }

  while (!pq.empty()) {
	e = pq.top();
	pq.pop();
	if (!u.same(e.node.F, e.node.S)) {
	  u.unite(e.node.F, e.node.S);
	  ans += e.cost;
	}
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 15456
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <complex>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <iterator>

using namespace std;

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define iter(c) __typeof__((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define all(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

const int INFTY=1<<29;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

int main()
{
	int tc; cin>>tc;
	rep(_,tc){
		int n,k; cin>>n>>k;
		vi xs(n); rep(i,n) cin>>xs[i];
		
		vi rs(n-1);
		rep(i,n-1) rs[i]=xs[i+1]-xs[i];
		
		sort(all(rs));
		rep(_,k-1) if(!rs.empty())
			rs.pop_back();
		
		cout<<accumulate(all(rs),0)<<endl;
	}
	
	return 0;
}

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

public class Main {
    public static void main(String args[]) throws IOException{
        process();
    }
    public static void process() throws IOException{
        BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
        char a[] = in.readLine().toCharArray();
        char b[] = in.readLine().toCharArray();
        String c= new String(a);
        String d= new String(b);
        int x = a.length;
        int y = b.length;
        String l=lcs(a, b, x, y);
        System.out.println(l);
    }
    public static String lcs(char a[],char b[],int x,int y) {
        int dp[][]=new int[x+1][y+1];
        for(int i=0;i<=x;i++) {
            for (int j = 0; j <= y; j++) {
                if (i == 0 || j  == 0)
                    dp[i][j] = 0;
                else if (a[i - 1] == b[j - 1])
                    dp[i][j] =1 + dp[i - 1][j - 1];
                else
                    dp[i][j] = Math.max(dp[i - 1][j], dp[i][j - 1]);
            }
        }
        int index=dp[x][y];
        int i=x;
        int j=y;
        char ans[]=new char[index+1];
        while(i>0 && j>0){
            if(a[i-1]==b[j-1]){
                ans[index]=a[i-1];
                i--;
                j--;
                index--;
            }
            else if(dp[i-1][j]>dp[i][j-1])
                i--;
            else
                j--;
        }
        return new String(ans).trim();
    }
}


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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int N; cin >> N;
    unordered_map<ll, int> m;
    rep(i, N){
        ll a; cin >> a;
        if(m[a]) m[a] = 0;
        else m[a] = 1;
    }
    ll res = 0;
    for(auto a: m){
        if(a.second) res++;
    }

    cout << res << endl;
}

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


Measured memory_bytes: 8484
#include<bits/stdc++.h>
using namespace std;
main(){
  int n,W;cin>>n>>W;
  long dp[110][100010],w[110],v[110];//n,価値
  for(int i=0;i<n;i++) cin>>w[i]>>v[i];
  for(int j=1;j<100010;j++) dp[0][j]=1e14+7;
  for(int i=0;i<n;i++){
    dp[i][0]=0;
    for(int j=1;j<100010;j++) dp[i+1][j]=min(dp[i][j],w[i]+dp[i][max(long(0),j-v[i])]);
  }
  long ans=0;
  for(long j=1;j<100010;j++) if(dp[n][j]<=W) ans=max(ans,j);
  cout<<ans<<endl;
}

Measured memory_bytes: 80896
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define repk(i,k, n) for (int i = k; i < (int)(n); ++i)
#define MAX 500010
typedef long long int ll;

using namespace std;

int ans;

int main() {
	int N;
	cin >> N;
	vector<int> B(N);
	rep(i, N - 1) { // 0 -> N-2
		cin >> B[i];
	}
	rep(i, N-1) {
		if (i == 0) ans += B[i];
		else {
			ans += min(B[i - 1], B[i]);
		}
		if (i == N - 2) ans += B[i];
	}

	cout << ans << endl;

	return 0;
}

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

signed main(void)
{
	string s;
	int ans;
	cin >> s;
	ans = 753;
	map<char, int> mp;
	rep(i, s.size() - 2)
	{
		string t = s.substr(i, 3);
		ans = min(abs(753 - ((t[0] - '0') * 100 + (t[1] - '0') * 10 + (t[2] - '0'))), ans);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>
#include <utility>
#include <stdio.h>
#include <unistd.h>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl
#define PI 3.14159265359

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const int mod = 1000000007;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}


int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  int now;
  cin >> now;
  ll ans = 0;
  rep (i, n - 1) {
    int tmp;
    cin >> tmp;
    ll diff = tmp - now;
    ans += min(b, diff * a);
    now = tmp;
  }
  P(ans);


  return 0;
}



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


using namespace std;

int main(void)
{
	int n;
	int ans;
	ans = 0;
	cin >> n;
	int i;
	for (i = 1; i <= n; i++)
	{
		ans = ans + i;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
a = int(input())
b = [int(x) for x in input().split()]

def pairs1(b, pairs=[], func=lambda x,y: x*y):
  if b == []:
    return pairs
  return pairs1(b[1:], pairs+[func(b[0], x) for x in b[1:]])

print(sum(pairs1(b)))

Measured memory_bytes: 3316
def main():
    n = int(input())
    h = list(map(int, input().split()))
    ans = 0
    count = 0

    for i in range(0, n-1):
        if h[i] >= h[i+1]:
            count += 1
            # print(count, h[i], h[i+1])
        else:
            count = 0
        if count > ans:
            ans = count

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 63856
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#define FI first
#define SE second
#define PF push_front
#define PB push_back
#define PPF pop_front
#define PPB pop_back
#define MA make_pair
#define ll long long
#define PA pair<int,int>
#define VE vector<int>
#define VP vector<PA>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
const int mod=1e9+7;
//
//
struct poi{
  int X;int Y;int Z;
  bool operator<(const poi&R)const{
    return X==R.X ? Y==R.Y ? Z<R.Z : Y<R.Y : X<R.X;
  }
};
//
//
int main(){
	int N;
	VP V;
	cin>>N;
	FOR(i,0,N){
		int A,B;
		cin>>A>>B;
		V.PB(MA(A,B));
	}
	sort(V.begin(),V.end());
	cout<<V[N-1].FI+V[N-1].SE<<endl;
	return 0;
}


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

int main() {
	long long n;
	cin>>n;
	long long i,p,q,r,sum=0;
	long long arr[100001]={0};
	for(i=0;i<n;i++)
	{
	cin>>p;
	arr[p]++;
	sum+=p;
	}
	cin>>q;
	while(q--)
	{
cin>>p>>r;
sum=sum-(arr[p]*p);
sum=sum+(arr[p]*r);
arr[r]=arr[r]+arr[p];
arr[p]=0;
	cout<<sum<<"\n";
		
	}
	
		
		
	
	// your code goes here
	return 0;
}

Measured memory_bytes: 4400
#include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,Q,K,A,B;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
typedef pair<ll, ll> P;
const ll INF = (1LL<<58);


int main() {
    cin>>S;
    int res = 0;
    rep(i, 3) res += S[i] == 'R';
    cout<<res - (S == "RSR")<<endl;
}

Measured memory_bytes: 3620
#!/usr/bin python3
# -*- coding: utf-8 -*-

import sys
input = sys.stdin.readline

def main():
    N = int(input())
    A = list(map(int, input().split()))
    ret = [0]*N
    for a in A:
        ret[a-1]+=1
    print('\n'.join(map(str, ret)))

if __name__ == '__main__':
    main()

Measured memory_bytes: 33036
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
vector<pair<pair<in,in>,in> > obd;
in r,c,n;
pair<in,in> onb(in x, in y){
  if(y==0){
    return MP(0,x);
  }
  if(x==r){
    return MP(1,y);
  }
  if(y==c){
    return MP(2,r-x);
  }
  if(x==0){
    return MP(3,c-y);
  }
  return MP(-1,-1);
}
VI csf;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin>>r>>c>>n;
  in x1,x2,y1,y2;
  pair<in,in> p1,p2;
  forn(z,n){
    cin>>x1>>y1>>x2>>y2;
    p1=onb(x1,y1);
    p2=onb(x2,y2);
    if(p1.first==-1 || p2.first==-1)
      continue;
    obd.PB(MP(p1,z));
    obd.PB(MP(p2,z));
  }
  sort(all(obd));
  in cr;
  forv(z,obd){
    cr=obd[z].second;
    if(!csf.empty() && csf.back()==cr)
      csf.pop_back();
    else
      csf.PB(cr);
  }
  if(csf.empty())
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
  return 0;
}


Measured memory_bytes: 8432
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lld long double
#define vc vector
typedef pair<ll,ll>pairs;
int main() {
	// your code goes here
	std::ios::sync_with_stdio(false);
	ll t,n,i,j,k,l,c,f;
	vector<ll>a;
	ll x,y;
	cin>>x>>y;
    if((y&1)||(y/2<x)||(2*x<y/2))
        cout<<"No";
    else
        cout<<"Yes";
	return 0;
}


Measured memory_bytes: 3652
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Programminng
{
    class AOJ_Volume0034
    {
        public static void Main(string[] args)
        {
            while (true)
            {
                string s = Console.ReadLine();
                if (string.IsNullOrEmpty(s)) break;

                string[] _s = s.Split(',');
                int[] values = new int[11];
                double[] v = new double[2];

                for (int i = 0; i < 11; i++)
                {
                    if (i == 0)
                    {
                        values[i] = 0;
                    }
                    else
                    {
                        values[i] = int.Parse(_s[i - 1]) + values[i - 1];
                    }
                }

                for (int i = 0; i < 2; i++)
                {
                    v[i] = int.Parse(_s[i + 10]);
                }

                double temp = v[0] / (v[0] + v[1]);
                temp *= values[10];

                bool flag = true;
                for (int i = 0; i < 10; i++)
                {
                    if (values[i] <= temp && temp <= values[i+1] && flag)
                    {
                        Console.WriteLine(i+1);
                        flag = false;
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 7648
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef long long lli;
typedef long double ld;
typedef pair<lli, lli > plli;
typedef vector<lli> vlli;
typedef vector<plli > vplli;

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define lcm(a, b) ((a * b) / gcd(a, b))
#define sqr(x) (x)*(x)
#define all(a) a.begin(),a.end()
#define UN(v) sort(all(v)), v.resize(unique(all(v))-v.begin())

#define endl '\n'

const long long INF = 100000000000000000;
const long long MOD = 1000000007;
const long long MAXN = 100005;

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

lli gcd(lli a , lli b) {
    if(b == 0) return a;
    a %= b;
    return gcd(b,a);
}

void solve() {
    lli r;
    cin >> r;
    cout << (3 * sqr(r)) << endl;
}

int main()
{
    IOS;
    lli t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
S=[]
total = 0
for i in range(M):
  iin = list(map(int,input().split()))
  k = iin[0]
  sin = 0
  for j in range(k):
    sin |= 1 << (iin[j+1] - 1) 
  S.append(sin)
p = list(map(int,input().split()))
for i in range(2**N):
  ok = 1
  for j in range(M):
    tmp = i & S[j]
    tmp2 = 0
    for ii in range(10):
      tmp2 += ((tmp >> ii) & 1)
    if (tmp2%2) != p[j]:
      ok = 0
      break
  if ok == 1:
    total += 1
print(total)


Measured memory_bytes: 3064
from collections import Counter
from itertools import permutations
n=int(input())
if n==1:print(1);exit()
XY=[list(map(int,input().split())) for _ in range(n)]
A=[(X[0]-Y[0],X[1]-Y[1]) for X,Y in permutations(XY,2)]
print(n-max(Counter(A).values()))

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

int main() {
  int N, K, x, A, B, sum;
  sum = 0;
  cin >> N >> K;
  
  for (int i = 0; i < N; i++) {
    cin >> x;
    
    if (x >= 0) {
      A = x;
    }
    else {
      A = -1 * x;
    }
    
    if (x - K >= 0) {
      B = x - K;
    }
    else {
      B = K - x;
    }
    
    if (A < B) {
      sum += 2 * A;
    }
    else {
      sum += 2 * B;
    }
  }
  
  cout << sum << endl;
}

Measured memory_bytes: 256
#include<algorithm>
#include<string>
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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


int main(){
    
    string cf;
    cin >> cf;
    string c;
    // cout << cf;
    REP(i,cf.size()){
        char c1=cf[i];
        // cout << c1;
        if(c1=='B' && c.size()!=0){
            c.pop_back();
        }
        else if(c1=='0' || c1=='1'){
            c.pb(c1);   
        }
    }

    REP(i,c.size()){
        cout << c[i];
    }

     cout << endl;
    return 0;
}

Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <cmath>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <numeric>
// #include <windows.h>
using namespace std;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = V<VV<T>>;
template<class T1, class T2> using P = pair<T1, T2>;
using I = int;
using D = double;
using B = bool;
using C = char;
using S = string;
using LL = long long;
using LD = long double;
using ULL = unsigned long long;
using PII = P<I, I>;
using VPII = V<PII>;
using PLL = P<LL, LL>;
using VPLL = V<PLL>;
using VI = V<I>;
using VVI = VV<I>;
using VLL = V<LL>;
using VVLL = VV<LL>;
using VC = V<C>;
using VVC = VV<C>;
using VS = V<S>;
using VVS = VV<S>;
using VB = V<B>;
using VVB = VV<B>;
#define REP(type, i, n) for (type i = 0; i < (type)(n); ++i)
#define REP2(type, i, m, n) for (type i = (m); i < (type)(n); ++i)
#define REPR(type, i, n) for (type i = (n)-1; i >= 0; --i)
#define REPR2(type, i, m, n) for (type i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a, type) sort(ALL(a), G<type>())
#define REVERSE(a) reverse(ALL(a))
#define SIZE(a, type) ((type)(a).size())
#define bit_search(bit, n) REP(LL, bit, 1LL<<(n))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REPx(&x, a) cin >> x;
#define INPUTP(a) REPx(&x, a) cin >> x.first >> x.second;
#define OUTPUT_PERMUTATION(n) do{VI v(n); iota(ALL(v), 1); do{REPx(x, v) cout << x << " "; ENDL} while(next_permutation(ALL(v)));} while(0);
#define MAKE_PERMUTATION(n, PER) do{VVI a(fact(n), VI(n)); int idx = 0; VI v(n); iota(ALL(v), 1); do{REP(roop, n) a[idx][roop] = v[roop]; idx++;} while(next_permutation(ALL(v))); PER = a;} while(0); // int fact(), VVI PERを宣言しておく、n=10が限界(500 ms)
#define ENDL cout << endl;

const int INF = 2e9;
const LL MOD = 1e9 + 7;

template<class T> using PRIORITY_QUEUE = priority_queue< T, V<T>, greater<T> >;
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 debug1(V<T> A){REP(int, i, SIZE(A, int)){if (A[i] == INF) cout << "I ";else cout << A[i] << " ";}ENDL}
template<class T> inline void debug2(VV<T> A){REP(int, i, SIZE(A, int)){REP(int, j, SIZE(A[i], int)){if (A[i][j] == INF) cout << "I "; else cout << A[i][j] << " ";}ENDL}}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s, t;
  cin >> s >> t;
  int ans = 0;
  REP(int, i, SIZE(s, int)) if (s[i] != t[i]) ans++;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3840
import math
n,k = map(int,input().split())
 
pi = 0
for i in range(1,n+1):
  need = math.ceil(math.log(k/i,2))  
  if need > 0:
    pi += (1/2) ** need
  else :
    pi +=1      
print(pi/n)    

Measured memory_bytes: 3316
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <cstring>
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
	int N; cin >> N;
	vector<int64_t> A(N+1);
	vector<int64_t> B(N);
	rep(i,N+1){
		cin >> A[i];
	}
	rep(i,N){
		cin >> B[i];
	}
	int64_t count = 0;
	int64_t a;
	for(int i = 0; i < N; i++){
		if(A[i] >= B[i]){
			count += B[i];
		}
		else{
			count+= A[i];
			a = A[i+1] - B[i] + A[i];
			if(a < 0){
				count+= A[i+1];
				A[i+1] = 0;
			}
			else{
				count += A[i+1] - a;
				A[i+1] = a;
			}
		}
	}
	cout << count << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <string>

using namespace std;
static const int M = 22370000;
bool Hash[M];

inline int convertChartoNum(char c)
{
	if (c == 'A')
	{
		return(1);
	}
	else if (c == 'C')
	{
		return(2);
	}
	else if (c == 'G')
	{
		return(3);
	}
	else if (c == 'T')
	{
		return(4);
	}
}

inline int getKey(string s)
{
	int sum = 0;
	int p = 1;
	for (int i = 0; i < s.size(); ++i)
	{
		sum += p * convertChartoNum(s[i]);
		p *= 4;
	}
	return(sum);
}

void solve()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		string command, str;
		cin >> command >> str;
		int key = getKey(str);
		if (command[0] == 'i')
		{
			if (!Hash[key])
			{
				Hash[key] = true;
			}
		}
		else
		{
			if (Hash[key])
			{
				printf("yes\n");
			}
			else
			{
				printf("no\n");
			}
		}
	}
}

int main()
{
	solve();
	return(0);
}

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

const int N = 1e5 + 15;
int n, m, a[N];
string s;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> s; n = s.size();
    if((n % 2 == 0) ^ (s[0] != s[n - 1]))
        cout << "First";
    else
        cout << "Second";
    return 0;
}

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

int32_t main(){
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    int now = 0;
    for (int i = 0; i < 1e7; i++){
        now = (now * 10 + 7) % n;
        if (now == 0){
            cout << i + 1;
            return 0;
        }
    }
    cout << -1;
	return 0;
}


Measured memory_bytes: 3612
#include<iostream>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)

using namespace std;

string sep = "####################";

int main() {
  int n; cin >> n;
  int tenants[4][3][10] = {0};
  REP(i, n) {
    int b, f, r, v;
    cin >> b >> f >> r >> v;
    tenants[b - 1][f - 1][r - 1] += v;
  }
  REP(i, 4) {
    if (i > 0) cout << sep << endl;
    REP(j, 3) {
      REP(k, 10) {
        cout << ' ' << tenants[i][j][k];
      }
      cout << endl;
    }
  }
}


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

int main() {
  int m,d,ans;
  cin >> m >> d;
  ans = 0;
  for(int i=22; i<=d; i++){
    string i_s = to_string(i);
    if (((i_s[0]-'0')<2)||((i_s[1]-'0')<2)) continue;
    int p = (i_s[0]-'0')*(i_s[1]-'0');
    if ((p <= m)&&(p > 0)) ans++;
  }

  cout << ans << endl;

  return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define MOD 1000000007

typedef long long int ll;

//const ll INF=(ll)1e19;
const int INF=(1<<30);

struct pos{
  int x;
  int y;
};

int main(){
  int H,W,D;
  cin >> H >> W >> D;

  vector<pos> p(H*W+1);

  REP(i,H)REP(j,W){
    int a;
    cin >> a;
    p[a] = pos{i,j};
  }

  vector<int> d(H*W+1,0);
  
  FOR(i,D+1,H*W+1){
    d[i] = d[i-D] + abs(p[i].x - p[i-D].x) + abs(p[i].y - p[i-D].y);
  }

  int Q;
  cin >> Q;
  REP(i,Q){
    int l,r;
    cin >> l >> r;
    cout << d[r] - d[l] << endl;
  }

}



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

#define ll long long
#define ull unsigned long long 
#define endl '\n'
#define pii pair<int, int>
#define all(a) a.begin(),a.end()
template <typename T>
inline T gcd(T a, T b) { while (b != 0) swap(b, a %= b); return a; }

int main(){
    string s;
    cin >> s;
    vector<int> a(3);
    for(int i=0; i<(int)s.length(); ++i)
        ++a[s[i]-'a'];
    sort(all(a));

    if(a[2]-a[0] <= 1)
        cout << "YES";
    else
        cout << "NO";
}



Measured memory_bytes: 3764
use std::cmp;
use std::io::{self, Read};

fn main() {
    let stdin = {
        let mut s = String::new();
        io::stdin().read_to_string(&mut s).unwrap();
        s
    };
    let mut sc = Scanner::new(&stdin);

    let n: usize = sc.read().unwrap();
    let m: usize = sc.read().unwrap();
    let x: i32 = sc.read().unwrap();
    let y: i32 = sc.read().unwrap();
    let xs: Vec<i32> = sc.read_vec(n).unwrap();
    let ys: Vec<i32> = sc.read_vec(m).unwrap();

    let xmax = xs.iter().max().unwrap();
    let ymin = ys.iter().min().unwrap();

    if ymin > xmax && ymin > &x && ymin <= &y {
        println!("No War");
    } else {
        println!("War");
    }
}

struct Scanner<'a> {
    it: std::str::SplitWhitespace<'a>,
}

impl<'a> Scanner<'a> {
    fn new(s: &'a String) -> Scanner<'a> {
        Scanner {
            it: s.split_whitespace(),
        }
    }

    fn read<T: std::str::FromStr>(&mut self) -> Option<T> {
        self.it.next().and_then(|s| s.parse().ok())
    }

    fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Option<Vec<T>> {
        (0..n).map(|_| self.read()).collect()
    }

    fn read_vec2d<T: std::str::FromStr>(&mut self, m: usize, n: usize) -> Option<Vec<Vec<T>>> {
        (0..m).map(|_| self.read_vec(n)).collect()
    }
}


Measured memory_bytes: 4352
#include <cstdio>

typedef struct
{
  double x, y;
} Point;

bool intersect(const Point& p1, const Point& p2, const Point& p3, const Point& p4)
{
  if (((p1.x-p2.x)*(p3.y-p1.y)+(p1.y-p2.y)*(p1.x-p3.x)) *
      ((p1.x-p2.x)*(p4.y-p1.y)+(p1.y-p2.y)*(p1.x-p4.x)) < 0)
    return true;
  return false;
}

int main()
{
  Point a, b, c, d;
  while (scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",
	       &a.x, &a.y, &b.x, &b.y, &c.x, &c.y, &d.x, &d.y) != EOF) {

    if(intersect(a, c, b, d) && intersect(b, d, a, c))
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}

Measured memory_bytes: 0
import java.util.*;
import java.math.*;
import java.io.*;
 
class Main {
	static final int INF = 2 << 29;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] K = new int[n];
		int[] P = new int[n];
		for(int i = 0; i < n; i++) {
			K[i] = sc.nextInt();
			P[i] = sc.nextInt();
			System.out.println((((K[i]) % (P[i])) == 0)?P[i]:((K[i]) % (P[i])));
		}

	}
}
             
        

Measured memory_bytes: 20380
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
#define ll long long
#define ld long double
#define f first
#define s second
using namespace __gnu_pbds;
template<class T> using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

const int N = 2e5+5;
ll cnt[N];

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

    ll n,k;
    cin >> n >> k;
    set<ll> st;
    for(int i=1; i<=n; i++)
    {
        ll x;
        cin >> x;
        st.insert(x);
        cnt[x]++;
    }

    vector< ll > v;

    for(int i=1; i<=n; i++)
    {
        if (cnt[i])
        {
            v.push_back(cnt[i]);
        }
    }

    sort(v.begin() , v.end());
    int dif = max( (ll)0 , (ll)st.size()-k);
    ll ans=0;
    for(int i=0; i<dif && i<(int)v.size(); i++)
        ans += v[i];

    cout << ans;

    return 0;
}

Measured memory_bytes: 13428
import java.util.*;
import java.math.*;
class Main {
  public static void main(String[] args) {
    Scanner in=new Scanner(System.in);
    int n=in.nextInt();
    BigInteger bi1, bi2, bi3;
    bi1 = new BigInteger(Integer.toString(n));


    if(bi1.isProbablePrime(1))
    System.out.println(n);
    else{
    bi2 = bi1.nextProbablePrime();
    System.out.println(bi2);
    }
  }
}

Measured memory_bytes: 21972
import collections

N = int(input())
a = list(map(int, input().split()))
b = collections.deque()

for i in range(N):
    if i % 2 == 0:
        b.appendleft(a[i])
    else:
        b.append(a[i])
    
if N % 2 == 0:
    i = N-1
    while i >= 0:
        print(b[i], end = ' ')
        i -= 1
else:
    for i in range(N):
        print(b[i], end = ' ')

Measured memory_bytes: 25412
#include<iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include<bitset>
#include<list>
#include<cassert>
#include<numeric>


using namespace std;

const long long N = 1e5 + 5;
long long a[N];
long long b[N];
long long c[N];
long long sumA;
long long sumB;
long long n;

int main()
{
	cin >> n;
	for (long long i = 0; i < n; i++)
	{
		cin >> a[i];
		sumA += a[i];
	}
	for (long long i = 0; i < n; i++)
	{
		cin >> b[i];
		sumB += b[i];
	}
	if (sumA < sumB)
	{
		cout << -1;
		exit(0);
	}
	for (long long i = 0; i < n; i++)
	{
		c[i] = a[i] - b[i];
	}
	sort(c, c + n);
	reverse(c, c + n);
	long long x = n - 1;
	long long y = 0;
	long long ans = 0;
	long long negative = 0;
	long long posative = 0;
	while (c[x] < 0)
	{
		ans++;
		negative += abs(c[x]);
		x--;
	}
	while (posative < negative)
	{
		posative += c[y];
		y++;
		ans++;
	}
	cout << ans << endl;


    
    
}



Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i,a,b) for(i=a;i<b;i++)
#define per(i,b,a) for(i=b;i>=a;i--)
#define For(i,a,b) for(i=a;i<=b;i++)
#define Forenska(it,c) for(register __typeof(c.begin()) it=c.begin();it!=c.end();it++)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-x))
#define GREATER(x) x,vector<x>,greater<x>
using namespace std;
int i,j;
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pLL;
typedef vector<int> vec;
typedef vector<LL> vecL;
typedef vector<pii> vecP;
typedef vector<pLL> vecPL;
typedef vector<string> vecS;
typedef vector<vec> mat;
typedef complex<double> point;
const long double PI=3.14159265358979323846264338327950288;
const LL INFLL=0x3f3f3f3f3f3f3f3f;
const int INF=0x3f3f3f3f;
const long double EPS=1e-10;
int read()
{
	int x=0;
	char ch=' ';
	bool flag=false;
	while(!isdigit(ch))
	{
		if(ch=='-')flag=true;
		ch=getchar();
	}
	while(isdigit(ch))
	{
		x=(x<<3)+(x<<1)+ch-'0';
		ch=getchar();
	}
	return flag?-x:x;
}

int main()
{
	string s;
	cin>>s;
	int alpha=s.find("FESTIVAL");
	while(s.find("FESTIVAL",alpha+1)!=string::npos)
	{
		alpha=s.find("FESTIVAL",alpha+1);
	}
	s.erase(alpha);
	cout<<s<<endl;
	return 0;
}



Measured memory_bytes: 256
from collections import Counter

N = int(input())
S = list(sorted([sorted(input()) for i in range(N)]))
mini_count = 0
count = 0
tmp = S[0]

for i in range(1, N):
    if tmp == S[i]:
        mini_count += 1
        count += mini_count
    else:
        tmp = S[i]
        mini_count = 0

print(count)

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


int h,w;
char maze[60][60];
int x,y;
int d[60][60];
int dx[4]={-1,0,1,0}; int dy[4]={0,1,0,-1};


int main(){
  cin >>h>>w;
  int black=0;
  rep(i,h){
    rep(j,w){
      cin >> maze[i][j];
      if(maze[i][j]=='#'){
        black++;
      }
    }
  }
  queue<P>que;
  rep(i,h){rep(j,w){d[i][j]=100000;}}
  d[0][0]=0;
  que.push(P(0,0));

  while(que.size()){
    P p=que.front(); que.pop();
    for (int i=0; i<4; i++){
      int ny=p.first+dy[i] ; int nx = p.second+dx[i];
      if(nx>=0 && nx<w && ny>=0 && ny<h && d[ny][nx]==100000 &&maze[ny][nx]!='#'){
          d[ny][nx]=d[p.first][p.second] +1;
          que.push(P(ny,nx));
      }
      }
    }
  

  if(d[h-1][w-1]!=100000){
    cout << h*w-black-d[h-1][w-1]-1<<endl;
  }
  else{
    cout<<-1<<endl;
  }
  


}


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

int main(){
    int N,M,A,B;
    cin >> N >> M >> A >> B;

    vector<vector<char>> map;
    map.resize(1000);
    for(int i=0;i<1000;i++) map[i].resize(1000);

    for(int i=0;i<N;i++){
        for(int j=0;j<M;j++){
            map[j][i]='.';
        }
    }

    int H=N/2,W=M/2;
    if((A-W)%2!=0 && (B-H)%2!=0 && N%2!=0 && M%2!=0 && M>=3 && N>=3 && A>=2 && B>=2){
        map[M-1][N-1]=map[M-2][N-3]='>';
        map[M-2][N-1]=map[M-3][N-3]='<';
        map[M-1][N-3]=map[M-3][N-2]='^';
        map[M-1][N-2]=map[M-3][N-1]='v';
        A-=2;
        B-=2;
    }
    if(N%2!=0){
        for(int i=0;i<W;i++){
            if(A<=0 || map[2*i][N-1]!='.' || map[2*i+1][N-1]!='.') break;
            map[2*i][N-1]='<';
            map[2*i+1][N-1]='>';
            A--;
        }
    }
    if(M%2!=0){
        for(int i=0;i<H;i++){
            if(B<=0 || map[M-1][2*i]!='.' || map[M-1][2*i+1]!='.') break;
            map[M-1][2*i]='^';
            map[M-1][2*i+1]='v';
            B--;
        }
    }

    for(int i=0;i<W;i++){
        for(int j=0;j<H*2;j++){
            if(A<=0 || map[2*i][j]!='.' || map[2*i+1][j]!='.') continue;
            map[2*i][j]='<';
            map[2*i+1][j]='>';
            A--;
        }
    }
    for(int i=0;i<H;i++){
        for(int j=0;j<W*2;j++){
            if(B<=0 || map[j][2*i]!='.' || map[j][2*i+1]!='.') continue;
            map[j][2*i]='^';
            map[j][2*i+1]='v';
            B--;
        }
    }

    if(A==0 && B==0){
        cout << "YES" << endl;
        for(int i=0;i<N;i++){
            for(int j=0;j<M;j++){
                cout << map[j][i];
            }
            cout << endl;
        }
    }else{
        cout << "NO" << endl;
    }

    return 0;
}

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

class Pragram
{
    static void Main()
    {
        int length = int.Parse(Console.ReadLine());
        int[] numbers = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

        for (var i = 1; i < length; ++i)
        {
            // 出力
            for (var k = 0; k < length; ++k)
            {
                Console.Write(numbers[k]);
                if (k != length - 1) { Console.Write(' '); }
            }
            Console.WriteLine();

            var target = numbers[i];
            var compIndex = i - 1;

            while (0 <= compIndex && target < numbers[compIndex])
            {
                numbers[compIndex + 1] = numbers[compIndex];
                --compIndex;
            }

            numbers[compIndex + 1] = target;
        }

        // 出力
        for (var k = 0; k < length; ++k)
        {
            Console.Write(numbers[k]);
            if (k != length - 1) { Console.Write(' '); }
        }
        Console.WriteLine();
    }
}


Measured memory_bytes: 18248
using System;
using System.Linq;
namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = Console.ReadLine().Split(' ');
            var daysOfHoliday = int.Parse(a[0]);
            var hwDays = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).Sum();
            var playDays = daysOfHoliday - hwDays;
            playDays = playDays < 0 ? -1 : playDays;
            Console.WriteLine(playDays);
        }
    }
}


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

public class Program
{

    static void Main()
    {
        var n = long.Parse(Console.ReadLine());

        var result = FactorizeIntoPrimeFactor(n);
        var answer = result.Factors.Select(f => f.Degree)
                                  .Sum(d =>
                                  {
                                      var i = 1;
                                      while (d >= i)
                                      {
                                          d -= i;
                                          i++;
                                      }
                                      return i - 1;
                                  });


        Console.WriteLine(answer);
        
    }

    static PrimeFactorizationResult FactorizeIntoPrimeFactor(long n)
    {
        var result = new PrimeFactorizationResult();

        if(n == 1)
        {
            return result;
        }

        var i = 2L;
        while ((i * i) < n + 1)
        {
            if (n % i == 0)
            {
                result.Add(i);
                n /= i;
                i = 2;
            }
            else
            {
                i++;
            }
        }
        result.Add(n);

        return result;
    }

    class Factor
    {
        public long PrimeNumber { get; set; }
        public long Degree { get; set; }

    }

    class PrimeFactorizationResult
    {
        public List<Factor> Factors { get; set; } = new List<Factor>();

        public void Add(long primeNumber)
        {
            var factor = Factors.FirstOrDefault(f => f.PrimeNumber == primeNumber);
            if(factor == null)
            {
                factor = new Factor { PrimeNumber = primeNumber, Degree = 1 };
                Factors.Add(factor);
            }
            else
            {
                factor.Degree++;
            }
        }
    }
}


Measured memory_bytes: 28248
#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() {
	int	N;
	cin >> N;
	vector<tuple<int, int, char, int64_t, string>> vec;
	rep(i, N)
	{
		int		a, b;
		char	c;
		int64_t	d;
		string	s;
		cin >> a >> b >> c >> d >> s;
		vec.push_back(make_tuple(a, b, c, d, s));
	}
	sort(vec.begin(), vec.end());
	for (auto t : vec)
	{
		int		a, b;
		char	c;
		int64_t	d;
		string	s;
		tie(a, b, c, d, s) = t;
		cout << a << ' ' << b << ' ' << c << ' ' << d << ' ' << s << endl;
	}
}



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

int main(){
  string str;
  cin >> str;
  if(str=="AAA"||str=="BBB"){
    cout << "No" << endl;
    return 0;
  }
  else{
    cout << "Yes" << endl;
    return 0;
  }
}
    


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
 
struct P{
  int team;
  int ans;
  int sum;
  int pro[100];
  static bool less(const P& left,const P& right){
    if(left.ans!=right.ans) return left.ans > right.ans;
    else if(left.sum!=right.sum)return  left.sum < right.sum;
    else return left.team < right.team;
  }
};
 
int main(){
  int t,p,r,tid,pid,time;
  string sta;
  while(cin >> t >> p >> r){
    if(t == 0 && r == 0 && p == 0) break;
    vector <P> data;
    P tmp;
    for(int i=0;i<t;i++){
      tmp.team = i+1;
      tmp.ans = 0;
      tmp.sum = 0;
      for(int j=0;j<=p;j++) tmp.pro[j] = 0;
      data.push_back(tmp);
    }
    while(r--){
      cin >> tid >> pid >> time >> sta;
      if(sta == "CORRECT"){
	for(int i=0;i<t;i++){
	  if(data[i].team == tid){
	    data[i].sum += data[i].pro[pid]*1200+time;
	    data[i].ans += 1;
	    break;
	  }
	}
      }
      else if(sta == "WRONG"){
	for(int i=0;i<t;i++){
	  if(data[i].team == tid) data[i].pro[pid] += 1;
	}
      }
    }
    sort(data.begin(),data.end(),P::less);
    for(int i=0;i<t;i++) cout << data[i].team << " " << data[i].ans << " " << data[i].sum << endl;
  }
}

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

int main(){
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    if (s[k - 1] == 'A'){
        s.replace(k - 1, 1, "a");
    }
    if (s[k - 1] == 'B'){
        s.replace(k - 1, 1, "b");
    }
        if (s[k - 1] == 'C'){
        s.replace(k - 1, 1, "c");
    }
    cout << s;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#define N 10000
int sosuu(int);
int main(){
  int n,i,count=0;
  int A[N+1];
  scanf("%d",&n);
  for(i=1;i<=n;i++) scanf("%d", &A[i]);
  for(i=1;i<=n;i++){
    if(sosuu(A[i])==0) count++;
  }
  printf("%d\n",count);
  return 0;
}

int sosuu(int x){
  int i;
  for(i=2;i<=sqrt(x);i++){
    if((x%i)==0) return 1;
  }
  if(x!=1) return 0;
}

Measured memory_bytes: 628
use std::cmp::min;

#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>()
        }
    };
    (;;$n:expr) => {
        {
            (0..$n).map(|_| scan!()).collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let (a, b, c) = scan!(i64, i64, i64);

    println!("{}", min(b / a, c))
}


Measured memory_bytes: 4352